1 #define NOINLINE __attribute__((noinline)) 2 #define NODISCARD [[nodiscard]] 3 4 5 #include <stdarg.h> 6 #include <stdbool.h> 7 #include <stdint.h> 8 #include <stdlib.h> 9 10 enum FillRule { 11 A, 12 B, 13 }; 14 typedef uint8_t FillRule; 15 16 /** 17 * This will have a destructor manually implemented via variant_body, and 18 * similarly a Drop impl in Rust. 19 */ 20 typedef struct { 21 uintptr_t len; 22 uint32_t *ptr; 23 } OwnedSlice_u32; 24 25 typedef struct { 26 FillRule fill; 27 OwnedSlice_u32 coordinates; 28 } Polygon_u32; 29 30 /** 31 * This will have a destructor manually implemented via variant_body, and 32 * similarly a Drop impl in Rust. 33 */ 34 typedef struct { 35 uintptr_t len; 36 int32_t *ptr; 37 } OwnedSlice_i32; 38 39 enum Foo_u32_Tag { 40 Bar_u32, 41 Polygon1_u32, 42 Slice1_u32, 43 Slice2_u32, 44 Slice3_u32, 45 Slice4_u32, 46 }; 47 typedef uint8_t Foo_u32_Tag; 48 49 typedef struct { 50 FillRule fill; 51 OwnedSlice_u32 coords; 52 } Slice3_Body_u32; 53 54 typedef struct { 55 FillRule fill; 56 OwnedSlice_i32 coords; 57 } Slice4_Body_u32; 58 59 typedef struct { 60 Foo_u32_Tag tag; 61 union { 62 struct { 63 Polygon_u32 polygon1; 64 }; 65 struct { 66 OwnedSlice_u32 slice1; 67 }; 68 struct { 69 OwnedSlice_i32 slice2; 70 }; 71 Slice3_Body_u32 slice3; 72 Slice4_Body_u32 slice4; 73 }; 74 } Foo_u32; 75 76 typedef struct { 77 FillRule fill; 78 OwnedSlice_i32 coordinates; 79 } Polygon_i32; 80 81 enum Baz_i32_Tag { 82 Bar2_i32, 83 Polygon21_i32, 84 Slice21_i32, 85 Slice22_i32, 86 Slice23_i32, 87 Slice24_i32, 88 }; 89 typedef uint8_t Baz_i32_Tag; 90 91 typedef struct { 92 Baz_i32_Tag tag; 93 FillRule fill; 94 OwnedSlice_i32 coords; 95 } Slice23_Body_i32; 96 97 typedef struct { 98 Baz_i32_Tag tag; 99 FillRule fill; 100 OwnedSlice_i32 coords; 101 } Slice24_Body_i32; 102 103 typedef union { 104 Baz_i32_Tag tag; 105 struct { 106 Baz_i32_Tag polygon21_tag; 107 Polygon_i32 polygon21; 108 }; 109 struct { 110 Baz_i32_Tag slice21_tag; 111 OwnedSlice_i32 slice21; 112 }; 113 struct { 114 Baz_i32_Tag slice22_tag; 115 OwnedSlice_i32 slice22; 116 }; 117 Slice23_Body_i32 slice23; 118 Slice24_Body_i32 slice24; 119 } Baz_i32; 120 121 enum Taz_Tag { 122 Bar3, 123 Taz1, 124 Taz3, 125 }; 126 typedef uint8_t Taz_Tag; 127 128 typedef union { 129 Taz_Tag tag; 130 struct { 131 Taz_Tag taz1_tag; 132 int32_t taz1; 133 }; 134 struct { 135 Taz_Tag taz3_tag; 136 OwnedSlice_i32 taz3; 137 }; 138 } Taz; 139 140 enum Tazz_Tag { 141 Bar4, 142 Taz2, 143 }; 144 typedef uint8_t Tazz_Tag; 145 146 typedef union { 147 Tazz_Tag tag; 148 struct { 149 Tazz_Tag taz2_tag; 150 int32_t taz2; 151 }; 152 } Tazz; 153 154 enum Tazzz_Tag { 155 Bar5, 156 Taz5, 157 }; 158 typedef uint8_t Tazzz_Tag; 159 160 typedef union { 161 Tazzz_Tag tag; 162 struct { 163 Tazzz_Tag taz5_tag; 164 int32_t taz5; 165 }; 166 } Tazzz; 167 168 enum Tazzzz_Tag { 169 Taz6, 170 Taz7, 171 }; 172 typedef uint8_t Tazzzz_Tag; 173 174 typedef union { 175 Tazzzz_Tag tag; 176 struct { 177 Tazzzz_Tag taz6_tag; 178 int32_t taz6; 179 }; 180 struct { 181 Tazzzz_Tag taz7_tag; 182 uint32_t taz7; 183 }; 184 } Tazzzz; 185 186 enum Qux_Tag { 187 Qux1, 188 Qux2, 189 }; 190 typedef uint8_t Qux_Tag; 191 192 typedef union { 193 Qux_Tag tag; 194 struct { 195 Qux_Tag qux1_tag; 196 int32_t qux1; 197 }; 198 struct { 199 Qux_Tag qux2_tag; 200 uint32_t qux2; 201 }; 202 } Qux; 203 204 void root(const Foo_u32 *a, 205 const Baz_i32 *b, 206 const Taz *c, 207 Tazz d, 208 const Tazzz *e, 209 const Tazzzz *f, 210 const Qux *g); 211