-- addDependentFile examples/golden/edge-cases/spec_examples.h
-- #include <edge-cases/spec_examples.h>
-- void hs_bindgen_8a72aafc705daf44 (
--   int32_T *arg1,
--   cint16_T (*arg2)[30720000],
--   int64_T arg3,
--   int64_T arg4,
--   cint16_T (*arg5)[30720000]
-- )
-- {
--   resample(arg1, *arg2, arg3, arg4, *arg5);
-- }
-- void hs_bindgen_2311fa9c0d0d6d06 (
--   int32_T *arg1,
--   cint16_T (*arg2)[30720000],
--   int64_T arg3,
--   int64_T arg4,
--   cint16_T (*arg5)[30720000]
-- )
-- {
--   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[30720000],
--   int64_T arg3,
--   int64_T arg4,
--   cint16_T arg5[30720000]
-- )
-- {
--   return &resample;
-- }
{-| Examples from the initial specification

__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}
      {- ^ Examples from the initial specification

      __C declaration:__ @int16_T@

      __defined at:__ @edge-cases\/spec_examples.h 10:15@

      __exported by:__ @edge-cases\/spec_examples.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType Int16_T "unwrapInt16_T") =>
         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}
      {- ^ __C declaration:__ @int32_T@

           __defined at:__ @edge-cases\/spec_examples.h 11:13@

           __exported by:__ @edge-cases\/spec_examples.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType Int32_T "unwrapInt32_T") =>
         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}
      {- ^ __C declaration:__ @int64_T@

           __defined at:__ @edge-cases\/spec_examples.h 12:19@

           __exported by:__ @edge-cases\/spec_examples.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType Int64_T "unwrapInt64_T") =>
         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@
                -}}
      {- ^ __C declaration:__ @struct cint16_T@

           __defined at:__ @edge-cases\/spec_examples.h 14:9@

           __exported by:__ @edge-cases\/spec_examples.h@
      -}
    deriving stock (Eq, 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
instance HasCField Cint16_T "cint16_T_re"
    where type CFieldType Cint16_T "cint16_T_re" = Int16_T
          offset# = \_ -> \_ -> 0
instance TyEq ty (CFieldType Cint16_T "cint16_T_re") =>
         HasField "cint16_T_re" (Ptr Cint16_T) (Ptr ty)
    where getField = fromPtr (Proxy @"cint16_T_re")
instance HasCField Cint16_T "cint16_T_im"
    where type CFieldType Cint16_T "cint16_T_im" = Int16_T
          offset# = \_ -> \_ -> 2
instance TyEq ty (CFieldType Cint16_T "cint16_T_im") =>
         HasField "cint16_T_im" (Ptr Cint16_T) (Ptr ty)
    where getField = fromPtr (Proxy @"cint16_T_im")
{-| __C declaration:__ @struct B@

    __defined at:__ @edge-cases\/spec_examples.h 19:8@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
data B
    = B {}
      {- ^ __C declaration:__ @struct B@

           __defined at:__ @edge-cases\/spec_examples.h 19:8@

           __exported by:__ @edge-cases\/spec_examples.h@
      -}
    deriving stock (Eq, 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 -> return ()
deriving via (EquivStorable B) instance Storable 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@
         -}}
      {- ^ __C declaration:__ @struct A@

           __defined at:__ @edge-cases\/spec_examples.h 23:8@

           __exported by:__ @edge-cases\/spec_examples.h@
      -}
    deriving stock (Eq, 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
instance HasCField A "a_x"
    where type CFieldType A "a_x" = CDouble
          offset# = \_ -> \_ -> 0
instance TyEq ty (CFieldType A "a_x") =>
         HasField "a_x" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_x")
instance HasCField A "a_label"
    where type CFieldType A "a_label" = Ptr CChar
          offset# = \_ -> \_ -> 8
instance TyEq ty (CFieldType A "a_label") =>
         HasField "a_label" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_label")
instance HasCField A "a_samples"
    where type CFieldType A "a_samples" = ConstantArray 128 CChar
          offset# = \_ -> \_ -> 16
instance TyEq ty (CFieldType A "a_samples") =>
         HasField "a_samples" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_samples")
instance HasCField A "a_b"
    where type CFieldType A "a_b" = B
          offset# = \_ -> \_ -> 144
instance TyEq ty (CFieldType A "a_b") =>
         HasField "a_b" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_b")
instance HasCField A "a_c"
    where type CFieldType A "a_c" = Ptr C
          offset# = \_ -> \_ -> 144
instance TyEq ty (CFieldType A "a_c") =>
         HasField "a_c" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_c")
{-| __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
 -> Int64
 -> Int64
 -> Ptr Void
 -> IO Unit
-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
hs_bindgen_8a72aafc705daf44 :: Ptr Int32_T ->
                               Ptr (ConstantArray 30720000 Cint16_T) ->
                               Int64_T ->
                               Int64_T -> Ptr (ConstantArray 30720000 Cint16_T) -> IO Unit
-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
hs_bindgen_8a72aafc705daf44 = fromFFIType hs_bindgen_8a72aafc705daf44_base
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample :: Ptr Int32_T ->
            Ptr (ConstantArray 30720000 Cint16_T) ->
            Int64_T ->
            Int64_T -> Ptr (ConstantArray 30720000 Cint16_T) -> IO Unit
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample = 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
 -> Int64
 -> Int64
 -> Ptr Void
 -> IO Unit
-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
hs_bindgen_2311fa9c0d0d6d06 :: Ptr Int32_T ->
                               Ptr (ConstantArray 30720000 Cint16_T) ->
                               Int64_T ->
                               Int64_T -> Ptr (ConstantArray 30720000 Cint16_T) -> IO Unit
-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
hs_bindgen_2311fa9c0d0d6d06 = fromFFIType hs_bindgen_2311fa9c0d0d6d06_base
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample :: Ptr Int32_T ->
            Ptr (ConstantArray 30720000 Cint16_T) ->
            Int64_T ->
            Int64_T -> Ptr (ConstantArray 30720000 Cint16_T) -> IO Unit
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample = 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 ->
                                           ConstantArray 30720000 Cint16_T ->
                                           Int64_T ->
                                           Int64_T -> ConstantArray 30720000 Cint16_T -> IO Unit))
-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
hs_bindgen_2b8fc800dad87ec8 = 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 :: FunPtr (Ptr Int32_T ->
                    ConstantArray 30720000 Cint16_T ->
                    Int64_T -> Int64_T -> ConstantArray 30720000 Cint16_T -> IO Unit)
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample = unsafePerformIO hs_bindgen_2b8fc800dad87ec8
