├── README.md ├── multithreaded_compiletime_ecs ├── README.md ├── code_sample.cpp ├── slides.pdf └── slides.pptx └── static_control_flow ├── README.md ├── code ├── asm │ ├── clang │ │ ├── staticfor_O0.s │ │ ├── staticfor_O1.s │ │ ├── staticfor_O2.s │ │ ├── staticfor_O3.s │ │ ├── traditional_O0.s │ │ ├── traditional_O1.s │ │ ├── traditional_O2.s │ │ └── traditional_O3.s │ ├── gcc │ │ ├── staticfor_O0.s │ │ ├── staticfor_O1.s │ │ ├── staticfor_O2.s │ │ ├── staticfor_O3.s │ │ ├── traditional_O0.s │ │ ├── traditional_O1.s │ │ ├── traditional_O2.s │ │ └── traditional_O3.s │ ├── staticfor.cpp │ └── traditional.cpp ├── cer ├── cerc ├── extra │ ├── type_lists.cpp │ └── y_combinator.cpp ├── impl │ ├── for_args.hpp │ ├── fwd.hpp │ ├── static_for.hpp │ ├── static_for_state.hpp │ ├── static_if.hpp │ └── y_combinator.hpp ├── p00.cpp ├── p01.cpp ├── p02.cpp ├── p03.cpp ├── p04.cpp ├── p05.cpp ├── p06.cpp ├── p07.cpp ├── p08.cpp ├── test_all_clang.sh ├── test_all_gcc.sh └── verify_sanitizers.sh ├── slides.pdf └── slides.pptx /README.md: -------------------------------------------------------------------------------- 1 | # meetingcpp2016 2 | 3 | Repository for my [Meeting C++ 2016](https://meetingcpp.com/index.php/mcpp2016.html) sessions. 4 | 5 | --- 6 | 7 | ## Implementation of a multithreaded compile-time ECS in C++14 8 | 9 | * [Meeting C++ page](https://meetingcpp.com/index.php/tv16/items/11.html) 10 | 11 | * [YouTube video](https://www.youtube.com/watch?v=51qSGUtaJwc&list=PLRyNF2Y6sca06lulacjysyu8RIwfKgYoY&index=55) 12 | 13 | --- 14 | 15 | ## Implementing `static` control flow in C++14 16 | 17 | * [Meeting C++ page](https://meetingcpp.com/index.php/tv16/items/12.html) 18 | 19 | * [YouTube video](https://www.youtube.com/watch?v=F5II2-cTgNw&list=PLRyNF2Y6sca06lulacjysyu8RIwfKgYoY&index=56) 20 | -------------------------------------------------------------------------------- /multithreaded_compiletime_ecs/README.md: -------------------------------------------------------------------------------- 1 | ## Implementation of a multithreaded compile-time ECS in C++14 2 | 3 | Main code repository: [SuperV1234/ecst](https://github.com/SuperV1234/ecst) 4 | 5 | --- 6 | 7 | * [Meeting C++ page](https://meetingcpp.com/index.php/tv16/items/11.html) 8 | 9 | * [YouTube video](https://www.youtube.com/watch?v=51qSGUtaJwc&list=PLRyNF2Y6sca06lulacjysyu8RIwfKgYoY&index=55) 10 | 11 | --- 12 | 13 | ## Usage/info 14 | 15 | ### Slides 16 | 17 | The slides were created with PowerPoint 2016 and heavily make use of *ink annotations* and *animations*. 18 | 19 | If you do not have PowerPoint installed, you can view them online *(for free, and on any platform)* using [PowerPoint online](https://office.live.com/start/PowerPoint.aspx 20 | ). Alternatively, you can upload the slides to your SkyDrive account and view them through there. 21 | 22 | Unfortunately, LibreOffice does not display ink annotations correctly. A PDF is available as well - animations were split in separate slides using [PPSpliT](http://www.dia.uniroma3.it/~rimondin/downloads.php). 23 | 24 | ### ECST library 25 | 26 | The **ECST** library [can be obtained here](https://github.com/SuperV1234/ecst). Usage and installation instructions are available on its repository README. -------------------------------------------------------------------------------- /multithreaded_compiletime_ecs/code_sample.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016 Vittorio Romeo 2 | // License: Academic Free License ("AFL") v. 3.0 3 | // AFL License page: http://opensource.org/licenses/AFL-3.0 4 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 5 | 6 | #include "./utils/dependencies.hpp" 7 | 8 | // The example consists of a simple particle simulation. All particles: 9 | // * Are massless and collide with each other in a perfectly inelastic way. 10 | // * Collide with the boundaries of the window. 11 | // * Are continuously destroyed and replaced by new particles. 12 | 13 | // Every particle will have the following components: 14 | // * Position (2D float vector). 15 | // * Velocity (2D float vector). 16 | // * Acceleration (2D float vector). 17 | // * Color (SFML color struct). 18 | // * Circle (radius float). 19 | // * Life (lifetime float). 20 | 21 | // The following systems will execute the simulation: 22 | // 23 | // * Acceleration: accelerates the particles. 24 | // (inner parallelism allowed) 25 | // (no dependencies) 26 | // 27 | // * Velocity: moves the particles. 28 | // (inner parallelism allowed) 29 | // (depends on: Acceleration) 30 | // 31 | // * Keep in bounds: prevents the particles from leaving the simulation's 32 | // boundaries. 33 | // (inner parallelism allowed) 34 | // (depends on: Velocity) 35 | // 36 | // * Spatial partition: partitions the simulation space in a 2D grid to speed 37 | // up broadphase collision detection. Produces lists of 38 | // {entity_id; grid_index} pairs that will be later 39 | // evaluated to fill the 2D grid. 40 | // (inner parallelism allowed) 41 | // (depends on: Keep in bounds) 42 | // 43 | // * Collision: detects collisions between particles and produces lists of 44 | // contacts that will be later evaluated to solve the collisions. 45 | // (inner parallelism allowed) 46 | // (depends on: Spatial partition) 47 | // 48 | // * Solve contacts: reads the contacts produced by Collision and solves them 49 | // by moving particles and changing their velocities. 50 | // (inner parallelism disallowed) 51 | // (depends on: Collision) 52 | // 53 | // * Render colored circle: produces lists of vertices that will be rendered 54 | // later on the SFML RenderWindow. 55 | // (inner parallelism allowed) 56 | // (depends on: Solve contacts) 57 | // 58 | // * Life: decrements the remaining lifetime of every particle and creates 59 | // new ones upon particle death. 60 | // (inner parallelism allowed) 61 | // (no dependencies) 62 | 63 | namespace example 64 | { 65 | // Boundaries of the simulation. 66 | constexpr auto left_bound = 0; 67 | constexpr auto right_bound = 1440; 68 | constexpr auto top_bound = 0; 69 | constexpr auto bottom_bound = 900; 70 | 71 | // Data of a collision contact. 72 | struct contact 73 | { 74 | // IDs of the colliding entities. 75 | ecst::entity_id _e0, _e1; 76 | 77 | // Distance between entities. 78 | float _dist; 79 | }; 80 | 81 | // Data for the assignment of an entity to a cell of the spatial 82 | // partitioning grid. 83 | struct sp_data 84 | { 85 | ecst::entity_id _e; 86 | sz_t _cell_x, _cell_y; 87 | }; 88 | 89 | // Component definitions. 90 | namespace c 91 | { 92 | // Components are simple classes, usually POD structs. There is no need 93 | // for components to derive from a "base component" class or to satisfy 94 | // a particular interface. 95 | 96 | struct position { vec2f _v; }; 97 | struct velocity { vec2f _v; }; 98 | struct acceleration { vec2f _v; }; 99 | struct color { sf::Color _v; }; 100 | struct circle { float _radius; }; 101 | struct life { float _v; }; 102 | } 103 | 104 | // In order to avoid the annoying `data.template ` syntax 105 | // and to have an uniform "type-value encoding" interface both in the 106 | // implementation and user code, we define component and system "tags". 107 | 108 | // These "tags" are empty `constexpr` objects that wrap the type of the 109 | // component/system in a value, which ECST's functions accept: 110 | /* 111 | // Traditional: 112 | data.template get(eid); 113 | 114 | // With tags: 115 | data.get(ct::position, eid); 116 | */ 117 | } 118 | 119 | // Component tags, in namespace `example::ct`. 120 | EXAMPLE_COMPONENT_TAG(acceleration); 121 | EXAMPLE_COMPONENT_TAG(velocity); 122 | EXAMPLE_COMPONENT_TAG(position); 123 | EXAMPLE_COMPONENT_TAG(circle); 124 | EXAMPLE_COMPONENT_TAG(color); 125 | EXAMPLE_COMPONENT_TAG(life); 126 | 127 | // A macro is used to define tags to suppress "unused variable" warnings and 128 | // to avoid code repetition. Essentially, it expands to: 129 | /* 130 | constexpr auto x = ecst::tag::component::v; 131 | */ 132 | 133 | // System tags, in namespace `example::st`. 134 | EXAMPLE_SYSTEM_TAG(acceleration); 135 | EXAMPLE_SYSTEM_TAG(velocity); 136 | EXAMPLE_SYSTEM_TAG(keep_in_bounds); 137 | EXAMPLE_SYSTEM_TAG(spatial_partition); 138 | EXAMPLE_SYSTEM_TAG(collision); 139 | EXAMPLE_SYSTEM_TAG(solve_contacts); 140 | EXAMPLE_SYSTEM_TAG(render_colored_circle); 141 | EXAMPLE_SYSTEM_TAG(life); 142 | 143 | namespace example 144 | { 145 | // System definitions. 146 | namespace s 147 | { 148 | // Systems are simple classes as well, that do not need to satisfy any 149 | // particular interface. They can store data and have any method the 150 | // user desires. 151 | 152 | // This system accelerates the subscribed particles. 153 | struct acceleration 154 | { 155 | // The `process` method is not hardcoded or specially recognized by 156 | // ECST in any way. Using a lambda in the execution code, we can 157 | // tell an ECST context to execute a particular method (also 158 | // forwarding extra arguments to it). 159 | 160 | // The `data` parameter is a proxy object generated by the system 161 | // execution strategy that abstracts away the eventual underlying 162 | // parallelism. 163 | 164 | template 165 | void process(ft dt, TData& data) 166 | { 167 | // Notice that the code below does not know anything about the 168 | // multithreading strategy employed by the system: the same 169 | // syntax works with any kind (or lack) of parallel execution. 170 | data.for_entities([&](auto eid) 171 | { 172 | auto& v = data.get(ct::velocity, eid)._v; 173 | const auto& a = data.get(ct::acceleration, eid)._v; 174 | 175 | v += a * dt; 176 | }); 177 | } 178 | }; 179 | 180 | // This system moves the subscribed particles. 181 | struct velocity 182 | { 183 | template 184 | void process(ft dt, TData& data) 185 | { 186 | data.for_entities([&](auto eid) 187 | { 188 | auto& p = data.get(ct::position, eid)._v; 189 | const auto& v = data.get(ct::velocity, eid)._v; 190 | 191 | p += v * dt; 192 | }); 193 | } 194 | }; 195 | 196 | // This system prevents the particles to get out of bounds. 197 | struct keep_in_bounds 198 | { 199 | template 200 | void process(TData& data) 201 | { 202 | data.for_entities([&](auto eid) 203 | { 204 | auto& p = data.get(ct::position, eid)._v; 205 | auto& v = data.get(ct::velocity, eid)._v; 206 | const auto& radius = data.get(ct::circle, eid)._radius; 207 | 208 | // Calculate the edge positions of the particle. 209 | auto left = p.x - radius; 210 | auto right = p.x + radius; 211 | auto top = p.y - radius; 212 | auto bottom = p.y + radius; 213 | 214 | // Move and invert X velocity if necessary. 215 | if(left < left_bound) 216 | { 217 | p.x = left_bound + radius; 218 | v.x *= -1; 219 | } 220 | else if(right > right_bound) 221 | { 222 | p.x = right_bound - radius; 223 | v.x *= -1; 224 | } 225 | 226 | // Move and invert Y velocity if necessary. 227 | if(top < top_bound) 228 | { 229 | p.y = top_bound + radius; 230 | v.y *= -1; 231 | } 232 | else if(bottom > bottom_bound) 233 | { 234 | p.y = bottom_bound - radius; 235 | v.y *= -1; 236 | } 237 | }); 238 | } 239 | }; 240 | 241 | // This system stores a spatial partitioning grid (to speed-up 242 | // broadphase collision detection) and outputs a vector of `sp_data`, 243 | // which is used in a later step to actually fill the spatial 244 | // partitioning grid. 245 | struct spatial_partition 246 | { 247 | // Partitioning constants. 248 | static constexpr sz_t cell_size = 8; 249 | static constexpr sz_t offset = 2; 250 | 251 | static constexpr sz_t grid_width = 252 | right_bound / cell_size + (offset * 2); 253 | 254 | static constexpr sz_t grid_height = 255 | bottom_bound / cell_size + (offset * 2); 256 | 257 | static constexpr sz_t cell_count = grid_width * grid_height; 258 | 259 | struct cell_type 260 | { 261 | std::vector _v; 262 | }; 263 | 264 | std::array, grid_width> _grid; 265 | 266 | // Clear all cells from the particles. 267 | void clear_cells() noexcept 268 | { 269 | for(auto& y : _grid) 270 | { 271 | for(auto& c : y) 272 | { 273 | c._v.clear(); 274 | } 275 | } 276 | } 277 | 278 | auto& cell_by_idxs(sz_t x, sz_t y) noexcept 279 | { 280 | return _grid[x + offset][y + offset]._v; 281 | } 282 | 283 | // Given an `sp_data`, emplaces an entity ID in a target cell. 284 | void add_sp(const sp_data& x) 285 | { 286 | cell_by_idxs(x._cell_x, x._cell_y).emplace_back(x._e); 287 | } 288 | 289 | // From world coordinates to cell index. 290 | auto idx(float x) noexcept 291 | { 292 | return x / cell_size; 293 | } 294 | 295 | // Returns the cell containing the position `p`. 296 | auto& cell_by_pos(const vec2f& p) noexcept 297 | { 298 | return cell_by_idxs(idx(p.x), idx(p.y)); 299 | } 300 | 301 | // Executes `f` on every cell contaning the circle described by `p` 302 | // and `r`. 303 | template 304 | void for_cells_of(const vec2f& p, float r, TF&& f) 305 | { 306 | auto left = p.x - r; 307 | auto right = p.x + r; 308 | auto top = p.y - r; 309 | auto bottom = p.y + r; 310 | 311 | auto s_ix = fFloor(idx(left)); 312 | auto e_ix = fCeil(idx(right)); 313 | auto s_iy = fFloor(idx(top)); 314 | auto e_iy = fCeil(idx(bottom)); 315 | 316 | for(auto ix(s_ix); ix <= e_ix; ++ix) 317 | { 318 | for(auto iy(s_iy); iy <= e_iy; ++iy) 319 | { 320 | f(ix, iy); 321 | } 322 | } 323 | } 324 | 325 | template 326 | void process(TData& data) 327 | { 328 | // Get a reference to the output vector and clear it. 329 | auto& o = data.output(); 330 | o.clear(); 331 | 332 | data.for_entities([&](auto eid) 333 | { 334 | // Access component data. 335 | const auto& p = data.get(ct::position, eid)._v; 336 | const auto& c = data.get(ct::circle, eid)._radius; 337 | 338 | // Figure out the broadphase cell and emplace an 339 | // `sp_data` instance in the output vector. 340 | this->for_cells_of(p, c, [eid, &o](auto cx, auto cy) 341 | { 342 | o.emplace_back(eid, cx, cy); 343 | }); 344 | }); 345 | } 346 | }; 347 | 348 | // This system detects collisions between particles and produces an 349 | // output vector of `contact` instances. 350 | struct collision 351 | { 352 | template 353 | void process(TData& data) 354 | { 355 | // Get a reference to the output vector and clear it. 356 | auto& out = data.output(); 357 | out.clear(); 358 | 359 | // Get a reference to the `spatial_partition` system. 360 | auto& sp = data.system(st::spatial_partition); 361 | 362 | // For every entity in the subtask... 363 | data.for_entities([&](auto eid) 364 | { 365 | // Access the component data. 366 | auto& p0 = data.get(ct::position, eid)._v; 367 | const auto& r0 = data.get(ct::circle, eid)._radius; 368 | 369 | // Access the grid cell containing position `p0`. 370 | auto& cell = sp.cell_by_pos(p0); 371 | 372 | // For every unique entity ID pair... 373 | for_unique_pairs(cell, eid, [&](auto eid2) 374 | { 375 | // Access the second particle's component data. 376 | auto& p1 = data.get(ct::position, eid2)._v; 377 | const auto& r1 = 378 | data.get(ct::circle, eid2)._radius; 379 | 380 | // Check for a circle-circle collision. 381 | auto sd = distance(p0, p1); 382 | if(sd <= r0 + r1) 383 | { 384 | // Emplace a `contact` in the output. 385 | out.emplace_back(eid, eid2, sd); 386 | } 387 | }); 388 | }); 389 | } 390 | }; 391 | 392 | // This single-threaded system solves contacts by preventing penetration 393 | // between particles and by modifying their velocities to simulate 394 | // bouncing. 395 | struct solve_contacts 396 | { 397 | template 398 | void process(TData& data) 399 | { 400 | // For every output produced by the collision detection 401 | // system... 402 | data.for_previous_outputs(st::collision, 403 | [&](auto&, const auto& out) 404 | { 405 | for(const auto& x : out) 406 | { 407 | // Access the f-Dirst particle's data. 408 | auto& p0 = data.get(ct::position, x._e0)._v; 409 | auto& v0 = data.get(ct::velocity, x._e0)._v; 410 | const auto& r0 = 411 | data.get(ct::circle, x._e0)._radius; 412 | 413 | // Access the second particle's data. 414 | auto& p1 = data.get(ct::position, x._e1)._v; 415 | auto& v1 = data.get(ct::velocity, x._e1)._v; 416 | const auto& r1 = 417 | data.get(ct::circle, x._e1)._radius; 418 | 419 | // Solve. 420 | solve_penetration(x._dist, p0, v0, r0, p1, v1, r1); 421 | } 422 | }); 423 | } 424 | }; 425 | 426 | // This system builds a vector of vertices for every subtask. 427 | // The vertices will then be rendered in a later step. 428 | struct render_colored_circle 429 | { 430 | static constexpr float tau = 6.28f; 431 | static constexpr sz_t precision = 5; 432 | static constexpr float inc = tau / precision; 433 | 434 | template 435 | void process(TData& data) 436 | { 437 | // Get a reference to the output vector, and clear it. 438 | auto& va = data.output(); 439 | va.clear(); 440 | 441 | // For every entity in the subtask... 442 | data.for_entities([this, &data, &va](auto eid) 443 | { 444 | // Access the component data. 445 | const auto& p0 = data.get(ct::position, eid)._v; 446 | const auto& c = data.get(ct::color, eid)._v; 447 | auto& radius = data.get(ct::circle, eid)._radius; 448 | 449 | // Function to create and emplace 3 vertices. 450 | auto mk_triangle = [&va, &data, &p0, &c, &radius]( 451 | auto a0, auto a1) 452 | { 453 | auto a0cos = radius * tbl_cos(a0); 454 | auto a0sin = radius * tbl_sin(a0); 455 | auto a1cos = radius * tbl_cos(a1); 456 | auto a1sin = radius * tbl_sin(a1); 457 | 458 | vec2f p1(a0cos + p0.x, a0sin + p0.y); 459 | vec2f p2(a1cos + p0.x, a1sin + p0.y); 460 | 461 | va.emplace_back(p0, c); 462 | va.emplace_back(p1, c); 463 | va.emplace_back(p2, c); 464 | }; 465 | 466 | // Build a circle. 467 | for(sz_t i = 0; i < precision; ++i) 468 | { 469 | mk_triangle(inc * i, inc * (i + 1)); 470 | } 471 | }); 472 | } 473 | }; 474 | 475 | // This system decrements the life of every particle, 476 | // spawning a new one in a random location upon death. 477 | struct life 478 | { 479 | template 480 | void process(ft dt, TData& data) 481 | { 482 | data.for_entities([&](auto eid) 483 | { 484 | auto& l = data.get(ct::life, eid)._v; 485 | l -= 10.f * dt; 486 | 487 | if(l <= 0.f) 488 | { 489 | data.kill_entity(eid); 490 | data.defer([](auto& proxy) 491 | { 492 | mk_particle( 493 | proxy, random_position(), rndf(1, 4)); 494 | }); 495 | } 496 | }); 497 | } 498 | }; 499 | } 500 | 501 | // Compile-time `std::size_t` entity limit. 502 | constexpr auto entity_limit = ecst::sz_v<65536>; 503 | 504 | // Compile-time initial particle count. 505 | constexpr auto initial_particle_count = ecst::sz_v<50000>; 506 | 507 | namespace ecst_setup 508 | { 509 | // Builds and returns a "component signature list". 510 | constexpr auto make_csl() 511 | { 512 | namespace cs = ecst::signature::component; 513 | namespace csl = ecst::signature_list::component; 514 | 515 | return csl::make( 516 | // Store `c::acceleration`, `c::velocity`, `c::position`, and `c::life` 517 | // in separate contiguous buffers (SoA). 518 | cs::make(ct::acceleration).contiguous_buffer(), 519 | cs::make(ct::velocity).contiguous_buffer(), 520 | cs::make(ct::position).contiguous_buffer(), 521 | cs::make(ct::life).contiguous_buffer(), 522 | 523 | // Store `c::color` and `c::circle` in the same contiguous buffer, 524 | // interleaved (AoS). 525 | cs::make(ct::color, ct::circle).contiguous_buffer() 526 | ); 527 | } 528 | 529 | // Builds and returns a "system signature list". 530 | constexpr auto make_ssl() 531 | { 532 | // Signature namespace aliases. 533 | namespace ss = ecst::signature::system; 534 | namespace sls = ecst::signature_list::system; 535 | 536 | // Inner parallelism aliases and definitions. 537 | namespace ips = ecst::inner_parallelism::strategy; 538 | namespace ipc = ecst::inner_parallelism::composer; 539 | constexpr auto none = ips::none::v(); 540 | constexpr auto split_evenly_per_core = 541 | ipc::none_below_threshold::v(ecst::sz_v<100>, 542 | ips::split_evenly_fn::v_cores() 543 | ); 544 | 545 | // Acceleration system. 546 | // * Multithreaded. 547 | // * No dependencies. 548 | constexpr auto ssig_acceleration = 549 | ss::make(st::acceleration) 550 | .parallelism(split_evenly_per_core) 551 | .read(ct::acceleration) 552 | .write(ct::velocity); 553 | 554 | // Velocity system. 555 | // * Multithreaded. 556 | constexpr auto ssig_velocity = 557 | ss::make(st::velocity) 558 | .parallelism(split_evenly_per_core) 559 | .dependencies(st::acceleration) 560 | .read(ct::velocity) 561 | .write(ct::position); 562 | 563 | // Keep in bounds system. 564 | // * Multithreaded. 565 | constexpr auto ssig_keep_in_bounds = 566 | ss::make(st::keep_in_bounds) 567 | .parallelism(split_evenly_per_core) 568 | .dependencies(st::velocity) 569 | .read(ct::circle) 570 | .write(ct::velocity, ct::position); 571 | 572 | // Spatial partition system. 573 | // * Multithreaded. 574 | // * Output: `std::vector`. 575 | constexpr auto ssig_spatial_partition = 576 | ss::make(st::spatial_partition) 577 | .parallelism(split_evenly_per_core) 578 | .dependencies(st::keep_in_bounds) 579 | .read(ct::position, ct::circle) 580 | .output(ss::output>); 581 | 582 | // Collision detection system. 583 | // * Multithreaded. 584 | // * Output: `std::vector`. 585 | constexpr auto ssig_collision = 586 | ss::make(st::collision) 587 | .parallelism(split_evenly_per_core) 588 | .dependencies(st::spatial_partition) 589 | .read(ct::circle) 590 | .write(ct::position, ct::velocity) 591 | .output(ss::output>); 592 | 593 | // Solve contacts system. 594 | // * Singlethreaded. 595 | constexpr auto ssig_solve_contacts = 596 | ss::make(st::solve_contacts) 597 | .parallelism(none) 598 | .dependencies(st::collision) 599 | .read(ct::circle) 600 | .write(ct::velocity, ct::position); 601 | 602 | // Render colored circle system. 603 | // * Multithreaded. 604 | // * Output: `std::vector`. 605 | constexpr auto ssig_render_colored_circle = 606 | ss::make(st::render_colored_circle) 607 | .parallelism(split_evenly_per_core) 608 | .dependencies(st::solve_contacts) 609 | .read(ct::circle, ct::position, ct::color) 610 | .output(ss::output>); 611 | 612 | // Particle death/creation system. 613 | // * Multithreaded. 614 | constexpr auto ssig_life = 615 | ss::make(st::life) 616 | .parallelism(split_evenly_per_core) 617 | .write(ct::life); 618 | 619 | // Build and return the "system signature list". 620 | return sls::make( 621 | ssig_acceleration, 622 | ssig_velocity, 623 | ssig_keep_in_bounds, 624 | ssig_spatial_partition, 625 | ssig_collision, 626 | ssig_solve_contacts, 627 | ssig_render_colored_circle, 628 | ssig_life 629 | ); 630 | } 631 | } 632 | 633 | template 634 | void mk_particle(TProxy& proxy, const vec2f& position, float radius) 635 | { 636 | auto eid = proxy.create_entity(); 637 | 638 | auto& ca = proxy.add_component(ct::acceleration, eid); 639 | ca._v.y = 1; 640 | 641 | auto& cv = proxy.add_component(ct::velocity, eid); 642 | cv._v = rndvec2f(-3, 3); 643 | 644 | auto& cp = proxy.add_component(ct::position, eid); 645 | cp._v = position; 646 | 647 | auto& cclr = proxy.add_component(ct::color, eid); 648 | cclr._v = sfc(rndf(0, 255), rndf(0, 255), rndf(0, 255), 255); 649 | 650 | auto& ccs = proxy.add_component(ct::circle, eid); 651 | ccs._radius = radius; 652 | 653 | auto& ccl = proxy.add_component(ct::life, eid); 654 | ccl._v = rndf(2, 10); 655 | } 656 | 657 | template 658 | void init_ctx(TContext& ctx) 659 | { 660 | ctx.step([&](auto& proxy) 661 | { 662 | for(sz_t i = 0; i < initial_particle_count; ++i) 663 | { 664 | mk_particle(proxy, random_position(), rndf(1, 4)); 665 | } 666 | }); 667 | } 668 | 669 | template 670 | void update_ctx(TContext& ctx, TRenderTarget& rt, ft dt) 671 | { 672 | namespace sea = ::ecst::system_execution_adapter; 673 | 674 | // Tags of frametime-dependent systems. 675 | auto ft_tags = 676 | sea::t(st::acceleration, st::velocity, st::life); 677 | 678 | // Tags of frametime-indepedent systems. 679 | auto nonft_tags = sea::t(st::keep_in_bounds, st::collision, 680 | st::solve_contacts, st::render_colored_circle); 681 | 682 | ctx.step([&rt, dt, &ft_tags, &nonft_tags](auto& proxy) 683 | { 684 | proxy.execute_systems()( 685 | // Simple execution with `for_subtasks`. 686 | ft_tags.for_subtasks([dt](auto& s, auto& data) 687 | { 688 | s.process(dt, data); 689 | }), 690 | nonft_tags.for_subtasks([](auto& s, auto& data) 691 | { 692 | s.process(data); 693 | }), 694 | 695 | // Detailed execution with `detailed_instance`. 696 | sea::t(st::spatial_partition) 697 | .detailed_instance([&proxy](auto& i, auto& executor) 698 | { 699 | auto& s(i.system()); 700 | s.clear_cells(); 701 | 702 | executor.for_subtasks([&s](auto& data) 703 | { 704 | s.process(data); 705 | }); 706 | 707 | i.for_outputs([](auto& xs, auto& sp_vector) 708 | { 709 | for(const auto& x : sp_vector) 710 | { 711 | xs.add_sp(x); 712 | } 713 | }); 714 | })); 715 | 716 | // After execution, the outputs of every subtask of a 717 | // system can be iterated upon. 718 | proxy.for_system_outputs(st::render_colored_circle, 719 | [&rt](auto&, auto& va) 720 | { 721 | rt.draw(va.data(), va.size(), 722 | sf::PrimitiveType::Triangles, 723 | sf::RenderStates::Default); 724 | }); 725 | }); 726 | } 727 | } 728 | 729 | int main() 730 | { 731 | // Namespace aliases. 732 | using namespace example; 733 | using namespace example::ecst_setup; 734 | namespace cs = ecst::settings; 735 | namespace ss = ecst::scheduler; 736 | 737 | // Define ECST context settings. 738 | constexpr auto s = 739 | ecst::settings::make() 740 | .allow_inner_parallelism() 741 | .fixed_entity_limit(entity_limit) 742 | .component_signatures(make_csl()) 743 | .system_signatures(make_ssl()) 744 | .scheduler(cs::scheduler); 745 | 746 | // Create an ECST context. 747 | auto ctx = ecst::context::make_uptr(s); 748 | 749 | // Run the simulation. 750 | run_simulation(*ctx); 751 | } 752 | -------------------------------------------------------------------------------- /multithreaded_compiletime_ecs/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vittorioromeo/meetingcpp2016/7e81255d69dfbf75fd96f62a1de60a54caad95d0/multithreaded_compiletime_ecs/slides.pdf -------------------------------------------------------------------------------- /multithreaded_compiletime_ecs/slides.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vittorioromeo/meetingcpp2016/7e81255d69dfbf75fd96f62a1de60a54caad95d0/multithreaded_compiletime_ecs/slides.pptx -------------------------------------------------------------------------------- /static_control_flow/README.md: -------------------------------------------------------------------------------- 1 | ## Implementing `static` control flow in C++14 2 | 3 | * [Meeting C++ page](https://meetingcpp.com/index.php/tv16/items/12.html) 4 | 5 | * [YouTube video](https://www.youtube.com/watch?v=F5II2-cTgNw&list=PLRyNF2Y6sca06lulacjysyu8RIwfKgYoY&index=56) 6 | 7 | --- 8 | 9 | ## Usage/info 10 | 11 | ### Slides 12 | 13 | The slides were created with PowerPoint 2016 and heavily make use of *ink annotations* and *animations*. 14 | 15 | If you do not have PowerPoint installed, you can view them online *(for free, and on any platform)* using [PowerPoint online](https://office.live.com/start/PowerPoint.aspx 16 | ). Alternatively, you can upload the slides to your SkyDrive account and view them through there. 17 | 18 | Unfortunately, LibreOffice does not display ink annotations correctly. A PDF is available as well - animations were split in separate slides using [PPSpliT](http://www.dia.uniroma3.it/~rimondin/downloads.php). 19 | 20 | ### Code 21 | 22 | * All code segments are in the `./code` folder. 23 | 24 | * `static_for` assembly outputs are in the `./code/asm/` folder. -------------------------------------------------------------------------------- /static_control_flow/code/asm/clang/staticfor_O1.s: -------------------------------------------------------------------------------- 1 | .text 2 | .file "staticfor.cpp" 3 | .globl _Z7consumeRVi 4 | .align 16, 0x90 5 | .type _Z7consumeRVi,@function 6 | _Z7consumeRVi: # @_Z7consumeRVi 7 | .cfi_startproc 8 | # BB#0: 9 | movl (%rdi), %eax 10 | retq 11 | .Lfunc_end0: 12 | .size _Z7consumeRVi, .Lfunc_end0-_Z7consumeRVi 13 | .cfi_endproc 14 | 15 | .globl _Z5test0v 16 | .align 16, 0x90 17 | .type _Z5test0v,@function 18 | _Z5test0v: # @_Z5test0v 19 | .cfi_startproc 20 | # BB#0: 21 | subq $56, %rsp 22 | .Ltmp0: 23 | .cfi_def_cfa_offset 64 24 | movq %fs:40, %rax 25 | movq %rax, 48(%rsp) 26 | movl $0, 28(%rsp) 27 | leaq 28(%rsp), %rax 28 | movq %rax, 16(%rsp) 29 | leaq 16(%rsp), %rdi 30 | callq _Z10static_forIZ5test0vE3$_0EDaOT_ 31 | movq %rax, 8(%rsp) 32 | leaq 8(%rsp), %rdi 33 | callq _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ 34 | movq %rax, 32(%rsp) 35 | leaq 32(%rsp), %rdi 36 | callq _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ 37 | movl 28(%rsp), %eax 38 | movq %fs:40, %rcx 39 | cmpq 48(%rsp), %rcx 40 | jne .LBB1_2 41 | # BB#1: # %SP_return 42 | addq $56, %rsp 43 | retq 44 | .LBB1_2: # %CallStackCheckFailBlk 45 | callq __stack_chk_fail@PLT 46 | .Lfunc_end1: 47 | .size _Z5test0v, .Lfunc_end1-_Z5test0v 48 | .cfi_endproc 49 | 50 | .align 16, 0x90 51 | .type _Z10static_forIZ5test0vE3$_0EDaOT_,@function 52 | _Z10static_forIZ5test0vE3$_0EDaOT_: # @"_Z10static_forIZ5test0vE3$_0EDaOT_" 53 | .cfi_startproc 54 | # BB#0: 55 | subq $24, %rsp 56 | .Ltmp1: 57 | .cfi_def_cfa_offset 32 58 | movq %fs:40, %rax 59 | movq %rax, 16(%rsp) 60 | callq _ZSt7forwardIOZ5test0vE3$_0EOT_RNSt16remove_referenceIS2_E4typeE 61 | movq (%rax), %rax 62 | movq %rax, 8(%rsp) 63 | leaq 8(%rsp), %rdi 64 | callq _ZSt4moveIRZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_EONSt16remove_referenceIS3_E4typeES4_ 65 | movq %fs:40, %rcx 66 | cmpq 16(%rsp), %rcx 67 | jne .LBB2_2 68 | # BB#1: # %SP_return 69 | movq (%rax), %rax 70 | addq $24, %rsp 71 | retq 72 | .LBB2_2: # %CallStackCheckFailBlk 73 | callq __stack_chk_fail@PLT 74 | .Lfunc_end2: 75 | .size _Z10static_forIZ5test0vE3$_0EDaOT_, .Lfunc_end2-_Z10static_forIZ5test0vE3$_0EDaOT_ 76 | .cfi_endproc 77 | 78 | .align 16, 0x90 79 | .type _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_,@function 80 | _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_: # @"_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_" 81 | .cfi_startproc 82 | # BB#0: 83 | movq (%rdi), %rax 84 | retq 85 | .Lfunc_end3: 86 | .size _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_, .Lfunc_end3-_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ 87 | .cfi_endproc 88 | 89 | .align 16, 0x90 90 | .type _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_,@function 91 | _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_: # @"_ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_" 92 | .cfi_startproc 93 | # BB#0: 94 | pushq %r15 95 | .Ltmp2: 96 | .cfi_def_cfa_offset 16 97 | pushq %r14 98 | .Ltmp3: 99 | .cfi_def_cfa_offset 24 100 | pushq %rbx 101 | .Ltmp4: 102 | .cfi_def_cfa_offset 32 103 | subq $16, %rsp 104 | .Ltmp5: 105 | .cfi_def_cfa_offset 48 106 | .Ltmp6: 107 | .cfi_offset %rbx, -32 108 | .Ltmp7: 109 | .cfi_offset %r14, -24 110 | .Ltmp8: 111 | .cfi_offset %r15, -16 112 | movq %rdi, %r14 113 | movq %fs:40, %rax 114 | movq %rax, 8(%rsp) 115 | leaq (%rsp), %rdi 116 | callq _ZN4impl14static_if_implILb0EE5else_IZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_E_clIZ5test0vE7nothingEES5_S6_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEES5_SD_EUlS7_DpOT0_E_EES5_S7_ 117 | leaq _ZL5int_vILi1EE(%rip), %rdi 118 | callq _ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 119 | movq %rax, %r15 120 | leaq _ZL5int_vILi10EE(%rip), %rdi 121 | callq _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 122 | movq %rax, %rbx 123 | leaq _ZL5int_vILi100EE(%rip), %rdi 124 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 125 | movq %r14, %rdi 126 | movq %r15, %rsi 127 | movq %rbx, %rdx 128 | movq %rax, %rcx 129 | callq _ZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_ 130 | movq %fs:40, %rax 131 | cmpq 8(%rsp), %rax 132 | jne .LBB4_2 133 | # BB#1: # %SP_return 134 | addq $16, %rsp 135 | popq %rbx 136 | popq %r14 137 | popq %r15 138 | retq 139 | .LBB4_2: # %CallStackCheckFailBlk 140 | callq __stack_chk_fail@PLT 141 | .Lfunc_end4: 142 | .size _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_, .Lfunc_end4-_ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ 143 | .cfi_endproc 144 | 145 | .globl main 146 | .align 16, 0x90 147 | .type main,@function 148 | main: # @main 149 | .cfi_startproc 150 | # BB#0: 151 | subq $24, %rsp 152 | .Ltmp9: 153 | .cfi_def_cfa_offset 32 154 | movq %fs:40, %rax 155 | movq %rax, 16(%rsp) 156 | callq _Z5test0v@PLT 157 | movl %eax, 12(%rsp) 158 | movl 12(%rsp), %eax 159 | movq %fs:40, %rcx 160 | cmpq 16(%rsp), %rcx 161 | jne .LBB5_2 162 | # BB#1: # %SP_return 163 | addq $24, %rsp 164 | retq 165 | .LBB5_2: # %CallStackCheckFailBlk 166 | callq __stack_chk_fail@PLT 167 | .Lfunc_end5: 168 | .size main, .Lfunc_end5-main 169 | .cfi_endproc 170 | 171 | .align 16, 0x90 172 | .type _ZSt7forwardIOZ5test0vE3$_0EOT_RNSt16remove_referenceIS2_E4typeE,@function 173 | _ZSt7forwardIOZ5test0vE3$_0EOT_RNSt16remove_referenceIS2_E4typeE: # @"_ZSt7forwardIOZ5test0vE3$_0EOT_RNSt16remove_referenceIS2_E4typeE" 174 | .cfi_startproc 175 | # BB#0: 176 | movq %rdi, %rax 177 | retq 178 | .Lfunc_end6: 179 | .size _ZSt7forwardIOZ5test0vE3$_0EOT_RNSt16remove_referenceIS2_E4typeE, .Lfunc_end6-_ZSt7forwardIOZ5test0vE3$_0EOT_RNSt16remove_referenceIS2_E4typeE 180 | .cfi_endproc 181 | 182 | .align 16, 0x90 183 | .type _ZSt4moveIRZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_EONSt16remove_referenceIS3_E4typeES4_,@function 184 | _ZSt4moveIRZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_EONSt16remove_referenceIS3_E4typeES4_: # @"_ZSt4moveIRZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_EONSt16remove_referenceIS3_E4typeES4_" 185 | .cfi_startproc 186 | # BB#0: 187 | movq %rdi, %rax 188 | retq 189 | .Lfunc_end7: 190 | .size _ZSt4moveIRZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_EONSt16remove_referenceIS3_E4typeES4_, .Lfunc_end7-_ZSt4moveIRZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_EONSt16remove_referenceIS3_E4typeES4_ 191 | .cfi_endproc 192 | 193 | .section .text._Z9static_ifISt17integral_constantIbLb0EEEDaT_,"axG",@progbits,_Z9static_ifISt17integral_constantIbLb0EEEDaT_,comdat 194 | .weak _Z9static_ifISt17integral_constantIbLb0EEEDaT_ 195 | .align 16, 0x90 196 | .type _Z9static_ifISt17integral_constantIbLb0EEEDaT_,@function 197 | _Z9static_ifISt17integral_constantIbLb0EEEDaT_: # @_Z9static_ifISt17integral_constantIbLb0EEEDaT_ 198 | .cfi_startproc 199 | # BB#0: 200 | retq 201 | .Lfunc_end8: 202 | .size _Z9static_ifISt17integral_constantIbLb0EEEDaT_, .Lfunc_end8-_Z9static_ifISt17integral_constantIbLb0EEEDaT_ 203 | .cfi_endproc 204 | 205 | .text 206 | .align 16, 0x90 207 | .type _ZN4impl14static_if_implILb0EE5else_IZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_E_clIZ5test0vE7nothingEES5_S6_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEES5_SD_EUlS7_DpOT0_E_EES5_S7_,@function 208 | _ZN4impl14static_if_implILb0EE5else_IZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_E_clIZ5test0vE7nothingEES5_S6_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEES5_SD_EUlS7_DpOT0_E_EES5_S7_: # @"_ZN4impl14static_if_implILb0EE5else_IZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_E_clIZ5test0vE7nothingEES5_S6_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEES5_SD_EUlS7_DpOT0_E_EES5_S7_" 209 | .cfi_startproc 210 | # BB#0: 211 | pushq %rax 212 | .Ltmp10: 213 | .cfi_def_cfa_offset 16 214 | callq _ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE 215 | movq %rax, %rdi 216 | popq %rax 217 | jmp _ZN4impl21make_static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EES3_S5_ # TAILCALL 218 | .Lfunc_end9: 219 | .size _ZN4impl14static_if_implILb0EE5else_IZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_E_clIZ5test0vE7nothingEES5_S6_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEES5_SD_EUlS7_DpOT0_E_EES5_S7_, .Lfunc_end9-_ZN4impl14static_if_implILb0EE5else_IZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_E_clIZ5test0vE7nothingEES5_S6_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEES5_SD_EUlS7_DpOT0_E_EES5_S7_ 220 | .cfi_endproc 221 | 222 | .align 16, 0x90 223 | .type _ZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_,@function 224 | _ZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_: # @"_ZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_" 225 | .cfi_startproc 226 | # BB#0: 227 | pushq %r15 228 | .Ltmp11: 229 | .cfi_def_cfa_offset 16 230 | pushq %r14 231 | .Ltmp12: 232 | .cfi_def_cfa_offset 24 233 | pushq %r12 234 | .Ltmp13: 235 | .cfi_def_cfa_offset 32 236 | pushq %rbx 237 | .Ltmp14: 238 | .cfi_def_cfa_offset 40 239 | subq $24, %rsp 240 | .Ltmp15: 241 | .cfi_def_cfa_offset 64 242 | .Ltmp16: 243 | .cfi_offset %rbx, -40 244 | .Ltmp17: 245 | .cfi_offset %r12, -32 246 | .Ltmp18: 247 | .cfi_offset %r14, -24 248 | .Ltmp19: 249 | .cfi_offset %r15, -16 250 | movq %rcx, %r14 251 | movq %rdx, %r15 252 | movq %rsi, %rbx 253 | movq %fs:40, %rax 254 | movq %rax, 16(%rsp) 255 | callq _Z12y_combinatorIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES2_S4_ 256 | movq %rax, 8(%rsp) 257 | movq %rbx, %rdi 258 | callq _ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 259 | movq %rax, %r12 260 | movq %r15, %rdi 261 | callq _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 262 | movq %rax, %rbx 263 | movq %r14, %rdi 264 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 265 | leaq 8(%rsp), %rdi 266 | movq %r12, %rsi 267 | movq %rbx, %rdx 268 | movq %rax, %rcx 269 | callq _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRNS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_ 270 | movq %fs:40, %rax 271 | cmpq 16(%rsp), %rax 272 | jne .LBB10_2 273 | # BB#1: # %SP_return 274 | addq $24, %rsp 275 | popq %rbx 276 | popq %r12 277 | popq %r14 278 | popq %r15 279 | retq 280 | .LBB10_2: # %CallStackCheckFailBlk 281 | callq __stack_chk_fail@PLT 282 | .Lfunc_end10: 283 | .size _ZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_, .Lfunc_end10-_ZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_ 284 | .cfi_endproc 285 | 286 | .section .text._ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE,"axG",@progbits,_ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE,comdat 287 | .weak _ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE 288 | .align 16, 0x90 289 | .type _ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE,@function 290 | _ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE: # @_ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE 291 | .cfi_startproc 292 | # BB#0: 293 | movq %rdi, %rax 294 | retq 295 | .Lfunc_end11: 296 | .size _ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE, .Lfunc_end11-_ZSt7forwardIRKSt17integral_constantIiLi1EEEOT_RNSt16remove_referenceIS4_E4typeE 297 | .cfi_endproc 298 | 299 | .section .text._ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE,"axG",@progbits,_ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE,comdat 300 | .weak _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE 301 | .align 16, 0x90 302 | .type _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE,@function 303 | _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE: # @_ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE 304 | .cfi_startproc 305 | # BB#0: 306 | movq %rdi, %rax 307 | retq 308 | .Lfunc_end12: 309 | .size _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE, .Lfunc_end12-_ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE 310 | .cfi_endproc 311 | 312 | .section .text._ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE,"axG",@progbits,_ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE,comdat 313 | .weak _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE 314 | .align 16, 0x90 315 | .type _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE,@function 316 | _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE: # @_ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE 317 | .cfi_startproc 318 | # BB#0: 319 | movq %rdi, %rax 320 | retq 321 | .Lfunc_end13: 322 | .size _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE, .Lfunc_end13-_ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE 323 | .cfi_endproc 324 | 325 | .text 326 | .align 16, 0x90 327 | .type _ZN4impl21make_static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EES3_S5_,@function 328 | _ZN4impl21make_static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EES3_S5_: # @"_ZN4impl21make_static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EES3_S5_" 329 | .cfi_startproc 330 | # BB#0: 331 | subq $24, %rsp 332 | .Ltmp20: 333 | .cfi_def_cfa_offset 32 334 | movq %fs:40, %rax 335 | movq %rax, 16(%rsp) 336 | callq _ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE 337 | leaq 8(%rsp), %rdi 338 | movq %rax, %rsi 339 | callq _ZN4impl16static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EC2ISR_EES5_ 340 | movq %fs:40, %rax 341 | cmpq 16(%rsp), %rax 342 | jne .LBB14_2 343 | # BB#1: # %SP_return 344 | addq $24, %rsp 345 | retq 346 | .LBB14_2: # %CallStackCheckFailBlk 347 | callq __stack_chk_fail@PLT 348 | .Lfunc_end14: 349 | .size _ZN4impl21make_static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EES3_S5_, .Lfunc_end14-_ZN4impl21make_static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EES3_S5_ 350 | .cfi_endproc 351 | 352 | .align 16, 0x90 353 | .type _ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE,@function 354 | _ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE: # @"_ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE" 355 | .cfi_startproc 356 | # BB#0: 357 | movq %rdi, %rax 358 | retq 359 | .Lfunc_end15: 360 | .size _ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE, .Lfunc_end15-_ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE 361 | .cfi_endproc 362 | 363 | .align 16, 0x90 364 | .type _ZN4impl16static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EC2ISR_EES5_,@function 365 | _ZN4impl16static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EC2ISR_EES5_: # @"_ZN4impl16static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EC2ISR_EES5_" 366 | .cfi_startproc 367 | # BB#0: 368 | pushq %rbx 369 | .Ltmp21: 370 | .cfi_def_cfa_offset 16 371 | .Ltmp22: 372 | .cfi_offset %rbx, -16 373 | movq %rdi, %rbx 374 | movq %rsi, %rdi 375 | callq _ZSt7forwardIOZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_E_clIZ5test0vE7nothingEES2_S3_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSD_IiLi10EERKSD_IiLi100EEEEES2_SA_EUlS4_DpOT0_E_ES4_RNSt16remove_referenceIS3_E4typeE 376 | movb (%rax), %al 377 | movb %al, (%rbx) 378 | popq %rbx 379 | retq 380 | .Lfunc_end16: 381 | .size _ZN4impl16static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EC2ISR_EES5_, .Lfunc_end16-_ZN4impl16static_if_resultIZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_E_clIZ5test0vE7nothingEES3_S4_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSE_IiLi10EERKSE_IiLi100EEEEES3_SB_EUlS5_DpOT0_E_EC2ISR_EES5_ 382 | .cfi_endproc 383 | 384 | .align 16, 0x90 385 | .type _Z12y_combinatorIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES2_S4_,@function 386 | _Z12y_combinatorIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES2_S4_: # @"_Z12y_combinatorIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES2_S4_" 387 | .cfi_startproc 388 | # BB#0: 389 | subq $24, %rsp 390 | .Ltmp23: 391 | .cfi_def_cfa_offset 32 392 | movq %fs:40, %rax 393 | movq %rax, 16(%rsp) 394 | callq _ZSt7forwardIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES4_RNSt16remove_referenceIS3_E4typeE 395 | leaq 8(%rsp), %rdi 396 | movq %rax, %rsi 397 | callq _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EC2IRKSC_EES5_ 398 | movq %fs:40, %rax 399 | cmpq 16(%rsp), %rax 400 | jne .LBB17_2 401 | # BB#1: # %SP_return 402 | movq 8(%rsp), %rax 403 | addq $24, %rsp 404 | retq 405 | .LBB17_2: # %CallStackCheckFailBlk 406 | callq __stack_chk_fail@PLT 407 | .Lfunc_end17: 408 | .size _Z12y_combinatorIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES2_S4_, .Lfunc_end17-_Z12y_combinatorIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES2_S4_ 409 | .cfi_endproc 410 | 411 | .align 16, 0x90 412 | .type _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRNS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_,@function 413 | _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRNS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_: # @"_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRNS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_" 414 | .cfi_startproc 415 | # BB#0: 416 | pushq %r15 417 | .Ltmp24: 418 | .cfi_def_cfa_offset 16 419 | pushq %r14 420 | .Ltmp25: 421 | .cfi_def_cfa_offset 24 422 | pushq %r12 423 | .Ltmp26: 424 | .cfi_def_cfa_offset 32 425 | pushq %rbx 426 | .Ltmp27: 427 | .cfi_def_cfa_offset 40 428 | pushq %rax 429 | .Ltmp28: 430 | .cfi_def_cfa_offset 48 431 | .Ltmp29: 432 | .cfi_offset %rbx, -40 433 | .Ltmp30: 434 | .cfi_offset %r12, -32 435 | .Ltmp31: 436 | .cfi_offset %r14, -24 437 | .Ltmp32: 438 | .cfi_offset %r15, -16 439 | movq %rcx, %r14 440 | movq %rdx, %r15 441 | movq %rdi, %rbx 442 | callq _ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_ 443 | movq %rax, %r12 444 | movq %r15, %rdi 445 | callq _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 446 | movq %rax, %r15 447 | movq %r14, %rdi 448 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 449 | movq %rbx, %rdi 450 | movq %r12, %rsi 451 | movq %r15, %rdx 452 | movq %rax, %rcx 453 | addq $8, %rsp 454 | popq %rbx 455 | popq %r12 456 | popq %r14 457 | popq %r15 458 | jmp _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ # TAILCALL 459 | .Lfunc_end18: 460 | .size _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRNS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_, .Lfunc_end18-_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRNS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi1EERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_ 461 | .cfi_endproc 462 | 463 | .align 16, 0x90 464 | .type _ZSt7forwardIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES4_RNSt16remove_referenceIS3_E4typeE,@function 465 | _ZSt7forwardIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES4_RNSt16remove_referenceIS3_E4typeE: # @"_ZSt7forwardIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES4_RNSt16remove_referenceIS3_E4typeE" 466 | .cfi_startproc 467 | # BB#0: 468 | movq %rdi, %rax 469 | retq 470 | .Lfunc_end19: 471 | .size _ZSt7forwardIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES4_RNSt16remove_referenceIS3_E4typeE, .Lfunc_end19-_ZSt7forwardIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES4_RNSt16remove_referenceIS3_E4typeE 472 | .cfi_endproc 473 | 474 | .align 16, 0x90 475 | .type _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EC2IRKSC_EES5_,@function 476 | _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EC2IRKSC_EES5_: # @"_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EC2IRKSC_EES5_" 477 | .cfi_startproc 478 | # BB#0: 479 | pushq %rbx 480 | .Ltmp33: 481 | .cfi_def_cfa_offset 16 482 | .Ltmp34: 483 | .cfi_offset %rbx, -16 484 | movq %rdi, %rbx 485 | movq %rsi, %rdi 486 | callq _ZSt7forwardIRKZ10static_forIZ5test0vE3$_0EDaOT_EUlS3_T0_OT1_DpOT2_E_ES4_RNSt16remove_referenceIS3_E4typeE 487 | movq (%rax), %rax 488 | movq %rax, (%rbx) 489 | popq %rbx 490 | retq 491 | .Lfunc_end20: 492 | .size _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EC2IRKSC_EES5_, .Lfunc_end20-_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EC2IRKSC_EES5_ 493 | .cfi_endproc 494 | 495 | .align 16, 0x90 496 | .type _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_,@function 497 | _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_: # @"_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_" 498 | .cfi_startproc 499 | # BB#0: 500 | pushq %r14 501 | .Ltmp35: 502 | .cfi_def_cfa_offset 16 503 | pushq %rbx 504 | .Ltmp36: 505 | .cfi_def_cfa_offset 24 506 | subq $72, %rsp 507 | .Ltmp37: 508 | .cfi_def_cfa_offset 96 509 | .Ltmp38: 510 | .cfi_offset %rbx, -24 511 | .Ltmp39: 512 | .cfi_offset %r14, -16 513 | movq %rcx, %r14 514 | movq %rdx, %rbx 515 | movq %fs:40, %rax 516 | movq %rax, 64(%rsp) 517 | movq %rsi, 56(%rsp) 518 | callq _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi1EEEEDaT_T0_ 519 | movq %rbx, 40(%rsp) 520 | movq %r14, 48(%rsp) 521 | leaq 8(%rsp), %rbx 522 | leaq 32(%rsp), %rsi 523 | movq %rbx, %rdi 524 | callq _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi1EEJRKSL_IiLi10EERKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_ 525 | leaq 56(%rsp), %rsi 526 | movq %rbx, %rdi 527 | callq _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_ 528 | movq %fs:40, %rax 529 | cmpq 64(%rsp), %rax 530 | jne .LBB21_2 531 | # BB#1: # %SP_return 532 | addq $72, %rsp 533 | popq %rbx 534 | popq %r14 535 | retq 536 | .LBB21_2: # %CallStackCheckFailBlk 537 | callq __stack_chk_fail@PLT 538 | .Lfunc_end21: 539 | .size _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_, .Lfunc_end21-_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ 540 | .cfi_endproc 541 | 542 | .align 16, 0x90 543 | .type _ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_,@function 544 | _ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_: # @"_ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_" 545 | .cfi_startproc 546 | # BB#0: 547 | subq $24, %rsp 548 | .Ltmp40: 549 | .cfi_def_cfa_offset 32 550 | movq %rdi, %rax 551 | movq %fs:40, %rcx 552 | movq %rcx, 16(%rsp) 553 | leaq 8(%rsp), %rdi 554 | movq %rax, %rsi 555 | callq _ZNSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEC2ERSE_ 556 | movq %fs:40, %rax 557 | cmpq 16(%rsp), %rax 558 | jne .LBB22_2 559 | # BB#1: # %SP_return 560 | movq 8(%rsp), %rax 561 | addq $24, %rsp 562 | retq 563 | .LBB22_2: # %CallStackCheckFailBlk 564 | callq __stack_chk_fail@PLT 565 | .Lfunc_end22: 566 | .size _ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_, .Lfunc_end22-_ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_ 567 | .cfi_endproc 568 | 569 | .align 16, 0x90 570 | .type _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi1EEEEDaT_T0_,@function 571 | _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi1EEEEDaT_T0_: # @"_ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi1EEEEDaT_T0_" 572 | .cfi_startproc 573 | # BB#0: 574 | movq (%rdi), %rax 575 | movl $1, (%rax) 576 | movq (%rdi), %rdi 577 | jmp _Z7consumeRVi@PLT # TAILCALL 578 | .Lfunc_end23: 579 | .size _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi1EEEEDaT_T0_, .Lfunc_end23-_ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi1EEEEDaT_T0_ 580 | .cfi_endproc 581 | 582 | .align 16, 0x90 583 | .type _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi1EEJRKSL_IiLi10EERKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_,@function 584 | _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi1EEJRKSL_IiLi10EERKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_: # @"_ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi1EEJRKSL_IiLi10EERKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_" 585 | .cfi_startproc 586 | # BB#0: 587 | pushq %rbx 588 | .Ltmp41: 589 | .cfi_def_cfa_offset 16 590 | .Ltmp42: 591 | .cfi_offset %rbx, -16 592 | movq %rdi, %rbx 593 | movq %rsi, %rdi 594 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 595 | movq %rbx, %rdi 596 | movq %rax, %rsi 597 | callq _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_ 598 | movq %rbx, %rax 599 | popq %rbx 600 | retq 601 | .Lfunc_end24: 602 | .size _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi1EEJRKSL_IiLi10EERKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_, .Lfunc_end24-_ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi1EEJRKSL_IiLi10EERKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_ 603 | .cfi_endproc 604 | 605 | .align 16, 0x90 606 | .type _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_,@function 607 | _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_: # @"_ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_" 608 | .cfi_startproc 609 | # BB#0: 610 | movq 8(%rdi), %rax 611 | movq 16(%rdi), %rdx 612 | movq %rsi, %rdi 613 | movq %rax, %rsi 614 | jmp _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeES10_ # TAILCALL 615 | .Lfunc_end25: 616 | .size _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_, .Lfunc_end25-_ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi1EEJRKSI_IiLi10EERKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_ 617 | .cfi_endproc 618 | 619 | .section .text._ZNKSt17integral_constantIiLi1EEcviEv,"axG",@progbits,_ZNKSt17integral_constantIiLi1EEcviEv,comdat 620 | .weak _ZNKSt17integral_constantIiLi1EEcviEv 621 | .align 16, 0x90 622 | .type _ZNKSt17integral_constantIiLi1EEcviEv,@function 623 | _ZNKSt17integral_constantIiLi1EEcviEv: # @_ZNKSt17integral_constantIiLi1EEcviEv 624 | .cfi_startproc 625 | # BB#0: 626 | movl $1, %eax 627 | retq 628 | .Lfunc_end26: 629 | .size _ZNKSt17integral_constantIiLi1EEcviEv, .Lfunc_end26-_ZNKSt17integral_constantIiLi1EEcviEv 630 | .cfi_endproc 631 | 632 | .section .text.__clang_call_terminate,"axG",@progbits,__clang_call_terminate,comdat 633 | .hidden __clang_call_terminate 634 | .weak __clang_call_terminate 635 | .align 16, 0x90 636 | .type __clang_call_terminate,@function 637 | __clang_call_terminate: # @__clang_call_terminate 638 | # BB#0: 639 | pushq %rax 640 | callq __cxa_begin_catch@PLT 641 | callq _ZSt9terminatev@PLT 642 | .Lfunc_end27: 643 | .size __clang_call_terminate, .Lfunc_end27-__clang_call_terminate 644 | 645 | .text 646 | .align 16, 0x90 647 | .type _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_,@function 648 | _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_: # @"_ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_" 649 | .cfi_startproc 650 | # BB#0: 651 | pushq %rbx 652 | .Ltmp43: 653 | .cfi_def_cfa_offset 16 654 | .Ltmp44: 655 | .cfi_offset %rbx, -16 656 | movq %rdi, %rbx 657 | movq %rsi, %rdi 658 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 659 | movq %rbx, %rdi 660 | movq %rax, %rsi 661 | callq _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISY_EES5_ 662 | movq %rbx, %rax 663 | popq %rbx 664 | retq 665 | .Lfunc_end28: 666 | .size _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_, .Lfunc_end28-_ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_ 667 | .cfi_endproc 668 | 669 | .align 16, 0x90 670 | .type _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE,@function 671 | _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE: # @"_ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE" 672 | .cfi_startproc 673 | # BB#0: 674 | movq %rdi, %rax 675 | retq 676 | .Lfunc_end29: 677 | .size _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE, .Lfunc_end29-_ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 678 | .cfi_endproc 679 | 680 | .align 16, 0x90 681 | .type _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISY_EES5_,@function 682 | _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISY_EES5_: # @"_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISY_EES5_" 683 | .cfi_startproc 684 | # BB#0: 685 | pushq %rbx 686 | .Ltmp45: 687 | .cfi_def_cfa_offset 16 688 | .Ltmp46: 689 | .cfi_offset %rbx, -16 690 | movq %rdi, %rbx 691 | movq %rsi, %rdi 692 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 693 | movq 16(%rax), %rcx 694 | movq %rcx, 16(%rbx) 695 | movups (%rax), %xmm0 696 | movups %xmm0, (%rbx) 697 | popq %rbx 698 | retq 699 | .Lfunc_end30: 700 | .size _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISY_EES5_, .Lfunc_end30-_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi0EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi1EEJRKSJ_IiLi10EERKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISY_EES5_ 701 | .cfi_endproc 702 | 703 | .align 16, 0x90 704 | .type _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeES10_,@function 705 | _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeES10_: # @"_ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeES10_" 706 | .cfi_startproc 707 | # BB#0: 708 | pushq %r15 709 | .Ltmp47: 710 | .cfi_def_cfa_offset 16 711 | pushq %r14 712 | .Ltmp48: 713 | .cfi_def_cfa_offset 24 714 | pushq %rbx 715 | .Ltmp49: 716 | .cfi_def_cfa_offset 32 717 | .Ltmp50: 718 | .cfi_offset %rbx, -32 719 | .Ltmp51: 720 | .cfi_offset %r14, -24 721 | .Ltmp52: 722 | .cfi_offset %r15, -16 723 | movq %rdx, %r14 724 | movq %rsi, %rbx 725 | callq _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEE3getEv 726 | movq %rax, %r15 727 | movq %rbx, %rdi 728 | callq _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 729 | movq %rax, %rbx 730 | movq %r14, %rdi 731 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 732 | movq %r15, %rdi 733 | movq %rbx, %rsi 734 | movq %rax, %rdx 735 | popq %rbx 736 | popq %r14 737 | popq %r15 738 | jmp _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi10EERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SY_ # TAILCALL 739 | .Lfunc_end31: 740 | .size _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeES10_, .Lfunc_end31-_ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeES10_ 741 | .cfi_endproc 742 | 743 | .align 16, 0x90 744 | .type _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi10EERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SY_,@function 745 | _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi10EERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SY_: # @"_ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi10EERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SY_" 746 | .cfi_startproc 747 | # BB#0: 748 | pushq %r15 749 | .Ltmp53: 750 | .cfi_def_cfa_offset 16 751 | pushq %r14 752 | .Ltmp54: 753 | .cfi_def_cfa_offset 24 754 | pushq %rbx 755 | .Ltmp55: 756 | .cfi_def_cfa_offset 32 757 | .Ltmp56: 758 | .cfi_offset %rbx, -32 759 | .Ltmp57: 760 | .cfi_offset %r14, -24 761 | .Ltmp58: 762 | .cfi_offset %r15, -16 763 | movq %rdx, %r14 764 | movq %rsi, %rbx 765 | callq _ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE 766 | movq %rax, %r15 767 | movq %rbx, %rdi 768 | callq _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 769 | movq %rax, %rbx 770 | movq %r14, %rdi 771 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 772 | movq %r15, %rdi 773 | movq %rbx, %rsi 774 | movq %rax, %rdx 775 | popq %rbx 776 | popq %r14 777 | popq %r15 778 | jmp _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi1EES0_NS1_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_ # TAILCALL 779 | .Lfunc_end32: 780 | .size _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi10EERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SY_, .Lfunc_end32-_ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi10EERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SY_ 781 | .cfi_endproc 782 | 783 | .align 16, 0x90 784 | .type _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEE3getEv,@function 785 | _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEE3getEv: # @"_ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEE3getEv" 786 | .cfi_startproc 787 | # BB#0: 788 | movq (%rdi), %rax 789 | retq 790 | .Lfunc_end33: 791 | .size _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEE3getEv, .Lfunc_end33-_ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEE3getEv 792 | .cfi_endproc 793 | 794 | .align 16, 0x90 795 | .type _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi1EES0_NS1_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_,@function 796 | _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi1EES0_NS1_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_: # @"_ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi1EES0_NS1_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_" 797 | .cfi_startproc 798 | # BB#0: 799 | pushq %r15 800 | .Ltmp59: 801 | .cfi_def_cfa_offset 16 802 | pushq %r14 803 | .Ltmp60: 804 | .cfi_def_cfa_offset 24 805 | pushq %rbx 806 | .Ltmp61: 807 | .cfi_def_cfa_offset 32 808 | .Ltmp62: 809 | .cfi_offset %rbx, -32 810 | .Ltmp63: 811 | .cfi_offset %r14, -24 812 | .Ltmp64: 813 | .cfi_offset %r15, -16 814 | movq %rdx, %r14 815 | movq %rsi, %rbx 816 | callq _ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE 817 | movq %rax, %r15 818 | movq %rbx, %rdi 819 | callq _ZSt7forwardIRKSt17integral_constantIiLi10EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 820 | movq %rax, %rbx 821 | movq %r14, %rdi 822 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 823 | movq %r15, %rdi 824 | movq %rbx, %rsi 825 | movq %rax, %rdx 826 | popq %rbx 827 | popq %r14 828 | popq %r15 829 | jmp _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_ # TAILCALL 830 | .Lfunc_end34: 831 | .size _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi1EES0_NS1_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_, .Lfunc_end34-_ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi1EES0_NS1_6action10a_continueEEERKSI_IiLi10EERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_ 832 | .cfi_endproc 833 | 834 | .align 16, 0x90 835 | .type _ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE,@function 836 | _ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE: # @"_ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE" 837 | .cfi_startproc 838 | # BB#0: 839 | movq %rdi, %rax 840 | retq 841 | .Lfunc_end35: 842 | .size _ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE, .Lfunc_end35-_ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE 843 | .cfi_endproc 844 | 845 | .align 16, 0x90 846 | .type _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_,@function 847 | _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_: # @"_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_" 848 | .cfi_startproc 849 | # BB#0: 850 | pushq %r15 851 | .Ltmp65: 852 | .cfi_def_cfa_offset 16 853 | pushq %r14 854 | .Ltmp66: 855 | .cfi_def_cfa_offset 24 856 | pushq %rbx 857 | .Ltmp67: 858 | .cfi_def_cfa_offset 32 859 | .Ltmp68: 860 | .cfi_offset %rbx, -32 861 | .Ltmp69: 862 | .cfi_offset %r14, -24 863 | .Ltmp70: 864 | .cfi_offset %r15, -16 865 | movq %rdx, %r14 866 | movq %rdi, %rbx 867 | callq _ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_ 868 | movq %rax, %r15 869 | movq %r14, %rdi 870 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 871 | movq %rbx, %rdi 872 | movq %r15, %rsi 873 | movq %rax, %rdx 874 | popq %rbx 875 | popq %r14 876 | popq %r15 877 | jmp _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ # TAILCALL 878 | .Lfunc_end36: 879 | .size _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_, .Lfunc_end36-_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi10EERKSG_IiLi100EEEEEDcDpOT_ 880 | .cfi_endproc 881 | 882 | .align 16, 0x90 883 | .type _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_,@function 884 | _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_: # @"_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_" 885 | .cfi_startproc 886 | # BB#0: 887 | pushq %rbx 888 | .Ltmp71: 889 | .cfi_def_cfa_offset 16 890 | subq $48, %rsp 891 | .Ltmp72: 892 | .cfi_def_cfa_offset 64 893 | .Ltmp73: 894 | .cfi_offset %rbx, -16 895 | movq %rdx, %rbx 896 | movq %fs:40, %rax 897 | movq %rax, 40(%rsp) 898 | movq %rsi, 32(%rsp) 899 | callq _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi10EEEEDaT_T0_ 900 | movq %rbx, 24(%rsp) 901 | leaq 16(%rsp), %rdi 902 | callq _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi10EEJRKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_ 903 | movq %rax, 8(%rsp) 904 | leaq (%rsp), %rdi 905 | leaq 32(%rsp), %rsi 906 | callq _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_ 907 | movq %fs:40, %rax 908 | cmpq 40(%rsp), %rax 909 | jne .LBB37_2 910 | # BB#1: # %SP_return 911 | addq $48, %rsp 912 | popq %rbx 913 | retq 914 | .LBB37_2: # %CallStackCheckFailBlk 915 | callq __stack_chk_fail@PLT 916 | .Lfunc_end37: 917 | .size _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_, .Lfunc_end37-_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ 918 | .cfi_endproc 919 | 920 | .align 16, 0x90 921 | .type _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi10EEEEDaT_T0_,@function 922 | _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi10EEEEDaT_T0_: # @"_ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi10EEEEDaT_T0_" 923 | .cfi_startproc 924 | # BB#0: 925 | movq (%rdi), %rax 926 | movl $10, (%rax) 927 | movq (%rdi), %rdi 928 | jmp _Z7consumeRVi@PLT # TAILCALL 929 | .Lfunc_end38: 930 | .size _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi10EEEEDaT_T0_, .Lfunc_end38-_ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi10EEEEDaT_T0_ 931 | .cfi_endproc 932 | 933 | .align 16, 0x90 934 | .type _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi10EEJRKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_,@function 935 | _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi10EEJRKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_: # @"_ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi10EEJRKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_" 936 | .cfi_startproc 937 | # BB#0: 938 | pushq %rax 939 | .Ltmp74: 940 | .cfi_def_cfa_offset 16 941 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 942 | movq %rax, %rdi 943 | popq %rax 944 | jmp _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_ # TAILCALL 945 | .Lfunc_end39: 946 | .size _ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi10EEJRKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_, .Lfunc_end39-_ZN4impl14static_if_implILb0EE5else_IZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi10EEJRKSL_IiLi100EEEEES5_S6_S8_SA_SD_EUlS7_E0_EES5_S7_ 947 | .cfi_endproc 948 | 949 | .align 16, 0x90 950 | .type _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_,@function 951 | _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_: # @"_ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_" 952 | .cfi_startproc 953 | # BB#0: 954 | movq 8(%rdi), %rax 955 | movq %rsi, %rdi 956 | movq %rax, %rsi 957 | jmp _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeESX_ # TAILCALL 958 | .Lfunc_end40: 959 | .size _ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_, .Lfunc_end40-_ZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi10EEJRKSI_IiLi100EEEEES1_S2_S4_S6_S9_ENKUlS3_E0_clIRSG_EES1_S3_ 960 | .cfi_endproc 961 | 962 | .section .text._ZNKSt17integral_constantIiLi10EEcviEv,"axG",@progbits,_ZNKSt17integral_constantIiLi10EEcviEv,comdat 963 | .weak _ZNKSt17integral_constantIiLi10EEcviEv 964 | .align 16, 0x90 965 | .type _ZNKSt17integral_constantIiLi10EEcviEv,@function 966 | _ZNKSt17integral_constantIiLi10EEcviEv: # @_ZNKSt17integral_constantIiLi10EEcviEv 967 | .cfi_startproc 968 | # BB#0: 969 | movl $10, %eax 970 | retq 971 | .Lfunc_end41: 972 | .size _ZNKSt17integral_constantIiLi10EEcviEv, .Lfunc_end41-_ZNKSt17integral_constantIiLi10EEcviEv 973 | .cfi_endproc 974 | 975 | .text 976 | .align 16, 0x90 977 | .type _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_,@function 978 | _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_: # @"_ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_" 979 | .cfi_startproc 980 | # BB#0: 981 | subq $24, %rsp 982 | .Ltmp75: 983 | .cfi_def_cfa_offset 32 984 | movq %fs:40, %rax 985 | movq %rax, 16(%rsp) 986 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 987 | leaq (%rsp), %rdi 988 | movq %rax, %rsi 989 | callq _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISV_EES5_ 990 | movq %fs:40, %rax 991 | cmpq 16(%rsp), %rax 992 | jne .LBB42_2 993 | # BB#1: # %SP_return 994 | movq 8(%rsp), %rax 995 | addq $24, %rsp 996 | retq 997 | .LBB42_2: # %CallStackCheckFailBlk 998 | callq __stack_chk_fail@PLT 999 | .Lfunc_end42: 1000 | .size _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_, .Lfunc_end42-_ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EES3_S5_ 1001 | .cfi_endproc 1002 | 1003 | .align 16, 0x90 1004 | .type _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE,@function 1005 | _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE: # @"_ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE" 1006 | .cfi_startproc 1007 | # BB#0: 1008 | movq %rdi, %rax 1009 | retq 1010 | .Lfunc_end43: 1011 | .size _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE, .Lfunc_end43-_ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 1012 | .cfi_endproc 1013 | 1014 | .align 16, 0x90 1015 | .type _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISV_EES5_,@function 1016 | _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISV_EES5_: # @"_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISV_EES5_" 1017 | .cfi_startproc 1018 | # BB#0: 1019 | pushq %rbx 1020 | .Ltmp76: 1021 | .cfi_def_cfa_offset 16 1022 | .Ltmp77: 1023 | .cfi_offset %rbx, -16 1024 | movq %rdi, %rbx 1025 | movq %rsi, %rdi 1026 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES2_S3_S5_S7_SA_EUlS4_E0_ES4_RNSt16remove_referenceIS3_E4typeE 1027 | movups (%rax), %xmm0 1028 | movups %xmm0, (%rbx) 1029 | popq %rbx 1030 | retq 1031 | .Lfunc_end44: 1032 | .size _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISV_EES5_, .Lfunc_end44-_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi1EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi10EEJRKSJ_IiLi100EEEEES3_S4_S6_S8_SB_EUlS5_E0_EC2ISV_EES5_ 1033 | .cfi_endproc 1034 | 1035 | .align 16, 0x90 1036 | .type _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeESX_,@function 1037 | _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeESX_: # @"_ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeESX_" 1038 | .cfi_startproc 1039 | # BB#0: 1040 | pushq %r14 1041 | .Ltmp78: 1042 | .cfi_def_cfa_offset 16 1043 | pushq %rbx 1044 | .Ltmp79: 1045 | .cfi_def_cfa_offset 24 1046 | pushq %rax 1047 | .Ltmp80: 1048 | .cfi_def_cfa_offset 32 1049 | .Ltmp81: 1050 | .cfi_offset %rbx, -24 1051 | .Ltmp82: 1052 | .cfi_offset %r14, -16 1053 | movq %rsi, %r14 1054 | callq _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEE3getEv 1055 | movq %rax, %rbx 1056 | movq %r14, %rdi 1057 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 1058 | movq %rbx, %rdi 1059 | movq %rax, %rsi 1060 | addq $8, %rsp 1061 | popq %rbx 1062 | popq %r14 1063 | jmp _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SV_ # TAILCALL 1064 | .Lfunc_end45: 1065 | .size _ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeESX_, .Lfunc_end45-_ZNKSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEclIJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSI_IiLi100EEEEENSt9result_ofIFRSE_DpOT_EE4typeESX_ 1066 | .cfi_endproc 1067 | 1068 | .align 16, 0x90 1069 | .type _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SV_,@function 1070 | _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SV_: # @"_ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SV_" 1071 | .cfi_startproc 1072 | # BB#0: 1073 | pushq %r14 1074 | .Ltmp83: 1075 | .cfi_def_cfa_offset 16 1076 | pushq %rbx 1077 | .Ltmp84: 1078 | .cfi_def_cfa_offset 24 1079 | pushq %rax 1080 | .Ltmp85: 1081 | .cfi_def_cfa_offset 32 1082 | .Ltmp86: 1083 | .cfi_offset %rbx, -24 1084 | .Ltmp87: 1085 | .cfi_offset %r14, -16 1086 | movq %rsi, %r14 1087 | callq _ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE 1088 | movq %rax, %rbx 1089 | movq %r14, %rdi 1090 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 1091 | movq %rbx, %rdi 1092 | movq %rax, %rsi 1093 | addq $8, %rsp 1094 | popq %rbx 1095 | popq %r14 1096 | jmp _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi2EES0_NS1_6action10a_continueEEERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_ # TAILCALL 1097 | .Lfunc_end46: 1098 | .size _ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SV_, .Lfunc_end46-_ZSt8__invokeIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEJRKNS0_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS0_6action10a_continueEEERKSH_IiLi100EEEENSt9result_ofIFS6_DpOT0_EE4typeES6_SV_ 1099 | .cfi_endproc 1100 | 1101 | .align 16, 0x90 1102 | .type _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi2EES0_NS1_6action10a_continueEEERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_,@function 1103 | _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi2EES0_NS1_6action10a_continueEEERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_: # @"_ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi2EES0_NS1_6action10a_continueEEERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_" 1104 | .cfi_startproc 1105 | # BB#0: 1106 | pushq %r14 1107 | .Ltmp88: 1108 | .cfi_def_cfa_offset 16 1109 | pushq %rbx 1110 | .Ltmp89: 1111 | .cfi_def_cfa_offset 24 1112 | pushq %rax 1113 | .Ltmp90: 1114 | .cfi_def_cfa_offset 32 1115 | .Ltmp91: 1116 | .cfi_offset %rbx, -24 1117 | .Ltmp92: 1118 | .cfi_offset %r14, -16 1119 | movq %rsi, %r14 1120 | callq _ZSt7forwardIRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEES6_RNSt16remove_referenceIS5_E4typeE 1121 | movq %rax, %rbx 1122 | movq %r14, %rdi 1123 | callq _ZSt7forwardIRKSt17integral_constantIiLi100EEEOT_RNSt16remove_referenceIS4_E4typeE@PLT 1124 | movq %rbx, %rdi 1125 | movq %rax, %rsi 1126 | addq $8, %rsp 1127 | popq %rbx 1128 | popq %r14 1129 | jmp _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi100EEEEEDcDpOT_ # TAILCALL 1130 | .Lfunc_end47: 1131 | .size _ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi2EES0_NS1_6action10a_continueEEERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_, .Lfunc_end47-_ZSt13__invoke_implIZ5test0vE7nothingRN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS6_T0_OT1_DpOT2_E_EEJRKNS1_5stateISt17integral_constantIiLi2EES0_NS1_6action10a_continueEEERKSI_IiLi100EEEES6_St14__invoke_otherOS8_DpOT1_ 1132 | .cfi_endproc 1133 | 1134 | .align 16, 0x90 1135 | .type _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi100EEEEEDcDpOT_,@function 1136 | _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi100EEEEEDcDpOT_: # @"_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi100EEEEEDcDpOT_" 1137 | .cfi_startproc 1138 | # BB#0: 1139 | pushq %rbx 1140 | .Ltmp93: 1141 | .cfi_def_cfa_offset 16 1142 | .Ltmp94: 1143 | .cfi_offset %rbx, -16 1144 | movq %rdi, %rbx 1145 | callq _ZSt3refIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEESt17reference_wrapperIS5_ERS5_ 1146 | movq %rbx, %rdi 1147 | movq %rax, %rsi 1148 | popq %rbx 1149 | jmp _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi100EEJEEES1_S2_S4_S6_S9_ # TAILCALL 1150 | .Lfunc_end48: 1151 | .size _ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi100EEEEEDcDpOT_, .Lfunc_end48-_ZN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS4_T0_OT1_DpOT2_E_EclIJRKNS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSG_IiLi100EEEEEDcDpOT_ 1152 | .cfi_endproc 1153 | 1154 | .align 16, 0x90 1155 | .type _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi100EEJEEES1_S2_S4_S6_S9_,@function 1156 | _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi100EEJEEES1_S2_S4_S6_S9_: # @"_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi100EEJEEES1_S2_S4_S6_S9_" 1157 | .cfi_startproc 1158 | # BB#0: 1159 | subq $24, %rsp 1160 | .Ltmp95: 1161 | .cfi_def_cfa_offset 32 1162 | movq %fs:40, %rax 1163 | movq %rax, 16(%rsp) 1164 | callq _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi100EEEEDaT_T0_ 1165 | leaq 8(%rsp), %rdi 1166 | callq _ZN4impl14static_if_implILb1EE4thenIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi100EEJEEES5_S6_S8_SA_SD_EUlS7_E_EES5_S7_ 1167 | movq %fs:40, %rax 1168 | cmpq 16(%rsp), %rax 1169 | jne .LBB49_2 1170 | # BB#1: # %SP_return 1171 | addq $24, %rsp 1172 | retq 1173 | .LBB49_2: # %CallStackCheckFailBlk 1174 | callq __stack_chk_fail@PLT 1175 | .Lfunc_end49: 1176 | .size _ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi100EEJEEES1_S2_S4_S6_S9_, .Lfunc_end49-_ZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISA_EEENSD_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSD_6action10a_continueEEERKSI_IiLi100EEJEEES1_S2_S4_S6_S9_ 1177 | .cfi_endproc 1178 | 1179 | .align 16, 0x90 1180 | .type _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi100EEEEDaT_T0_,@function 1181 | _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi100EEEEDaT_T0_: # @"_ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi100EEEEDaT_T0_" 1182 | .cfi_startproc 1183 | # BB#0: 1184 | movq (%rdi), %rax 1185 | movl $100, (%rax) 1186 | movq (%rdi), %rdi 1187 | jmp _Z7consumeRVi@PLT # TAILCALL 1188 | .Lfunc_end50: 1189 | .size _ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi100EEEEDaT_T0_, .Lfunc_end50-_ZZ5test0vENK3$_0clIN4impl5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS1_6action10a_continueEEES3_IiLi100EEEEDaT_T0_ 1190 | .cfi_endproc 1191 | 1192 | .section .text._Z9static_ifISt17integral_constantIbLb1EEEDaT_,"axG",@progbits,_Z9static_ifISt17integral_constantIbLb1EEEDaT_,comdat 1193 | .weak _Z9static_ifISt17integral_constantIbLb1EEEDaT_ 1194 | .align 16, 0x90 1195 | .type _Z9static_ifISt17integral_constantIbLb1EEEDaT_,@function 1196 | _Z9static_ifISt17integral_constantIbLb1EEEDaT_: # @_Z9static_ifISt17integral_constantIbLb1EEEDaT_ 1197 | .cfi_startproc 1198 | # BB#0: 1199 | retq 1200 | .Lfunc_end51: 1201 | .size _Z9static_ifISt17integral_constantIbLb1EEEDaT_, .Lfunc_end51-_Z9static_ifISt17integral_constantIbLb1EEEDaT_ 1202 | .cfi_endproc 1203 | 1204 | .text 1205 | .align 16, 0x90 1206 | .type _ZN4impl14static_if_implILb1EE4thenIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi100EEJEEES5_S6_S8_SA_SD_EUlS7_E_EES5_S7_,@function 1207 | _ZN4impl14static_if_implILb1EE4thenIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi100EEJEEES5_S6_S8_SA_SD_EUlS7_E_EES5_S7_: # @"_ZN4impl14static_if_implILb1EE4thenIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi100EEJEEES5_S6_S8_SA_SD_EUlS7_E_EES5_S7_" 1208 | .cfi_startproc 1209 | # BB#0: 1210 | pushq %rax 1211 | .Ltmp96: 1212 | .cfi_def_cfa_offset 16 1213 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE 1214 | movq %rax, %rdi 1215 | popq %rax 1216 | jmp _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EES3_S5_ # TAILCALL 1217 | .Lfunc_end52: 1218 | .size _ZN4impl14static_if_implILb1EE4thenIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi100EEJEEES5_S6_S8_SA_SD_EUlS7_E_EES5_S7_, .Lfunc_end52-_ZN4impl14static_if_implILb1EE4thenIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS6_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISE_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSL_IiLi100EEJEEES5_S6_S8_SA_SD_EUlS7_E_EES5_S7_ 1219 | .cfi_endproc 1220 | 1221 | .align 16, 0x90 1222 | .type _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_E5else_IZZS1_IS2_ES3_S5_ENKSD_ISH_SO_SR_JEEES3_S4_S6_S8_SB_EUlS5_E0_EERDaS5_,@function 1223 | _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_E5else_IZZS1_IS2_ES3_S5_ENKSD_ISH_SO_SR_JEEES3_S4_S6_S8_SB_EUlS5_E0_EERDaS5_: # @"_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_E5else_IZZS1_IS2_ES3_S5_ENKSD_ISH_SO_SR_JEEES3_S4_S6_S8_SB_EUlS5_E0_EERDaS5_" 1224 | .cfi_startproc 1225 | # BB#0: 1226 | movq %rdi, %rax 1227 | retq 1228 | .Lfunc_end53: 1229 | .size _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_E5else_IZZS1_IS2_ES3_S5_ENKSD_ISH_SO_SR_JEEES3_S4_S6_S8_SB_EUlS5_E0_EERDaS5_, .Lfunc_end53-_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_E5else_IZZS1_IS2_ES3_S5_ENKSD_ISH_SO_SR_JEEES3_S4_S6_S8_SB_EUlS5_E0_EERDaS5_ 1230 | .cfi_endproc 1231 | 1232 | .section .text._ZNKSt17integral_constantIiLi100EEcviEv,"axG",@progbits,_ZNKSt17integral_constantIiLi100EEcviEv,comdat 1233 | .weak _ZNKSt17integral_constantIiLi100EEcviEv 1234 | .align 16, 0x90 1235 | .type _ZNKSt17integral_constantIiLi100EEcviEv,@function 1236 | _ZNKSt17integral_constantIiLi100EEcviEv: # @_ZNKSt17integral_constantIiLi100EEcviEv 1237 | .cfi_startproc 1238 | # BB#0: 1239 | movl $100, %eax 1240 | retq 1241 | .Lfunc_end54: 1242 | .size _ZNKSt17integral_constantIiLi100EEcviEv, .Lfunc_end54-_ZNKSt17integral_constantIiLi100EEcviEv 1243 | .cfi_endproc 1244 | 1245 | .text 1246 | .align 16, 0x90 1247 | .type _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EES3_S5_,@function 1248 | _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EES3_S5_: # @"_ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EES3_S5_" 1249 | .cfi_startproc 1250 | # BB#0: 1251 | subq $24, %rsp 1252 | .Ltmp97: 1253 | .cfi_def_cfa_offset 32 1254 | movq %fs:40, %rax 1255 | movq %rax, 16(%rsp) 1256 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE 1257 | leaq 8(%rsp), %rdi 1258 | movq %rax, %rsi 1259 | callq _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EC2ISS_EES5_ 1260 | movq %fs:40, %rax 1261 | cmpq 16(%rsp), %rax 1262 | jne .LBB55_2 1263 | # BB#1: # %SP_return 1264 | addq $24, %rsp 1265 | retq 1266 | .LBB55_2: # %CallStackCheckFailBlk 1267 | callq __stack_chk_fail@PLT 1268 | .Lfunc_end55: 1269 | .size _ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EES3_S5_, .Lfunc_end55-_ZN4impl21make_static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EES3_S5_ 1270 | .cfi_endproc 1271 | 1272 | .align 16, 0x90 1273 | .type _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE,@function 1274 | _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE: # @"_ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE" 1275 | .cfi_startproc 1276 | # BB#0: 1277 | movq %rdi, %rax 1278 | retq 1279 | .Lfunc_end56: 1280 | .size _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE, .Lfunc_end56-_ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE 1281 | .cfi_endproc 1282 | 1283 | .align 16, 0x90 1284 | .type _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EC2ISS_EES5_,@function 1285 | _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EC2ISS_EES5_: # @"_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EC2ISS_EES5_" 1286 | .cfi_startproc 1287 | # BB#0: 1288 | pushq %rbx 1289 | .Ltmp98: 1290 | .cfi_def_cfa_offset 16 1291 | .Ltmp99: 1292 | .cfi_offset %rbx, -16 1293 | movq %rdi, %rbx 1294 | movq %rsi, %rdi 1295 | callq _ZSt7forwardIOZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS3_T0_OT1_DpOT2_E_clISt17reference_wrapperIN4impl19y_combinator_resultISB_EEENSE_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNSE_6action10a_continueEEERKSJ_IiLi100EEJEEES2_S3_S5_S7_SA_EUlS4_E_ES4_RNSt16remove_referenceIS3_E4typeE 1296 | movb (%rax), %al 1297 | movb %al, (%rbx) 1298 | popq %rbx 1299 | retq 1300 | .Lfunc_end57: 1301 | .size _ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EC2ISS_EES5_, .Lfunc_end57-_ZN4impl16static_if_resultIZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS4_T0_OT1_DpOT2_E_clISt17reference_wrapperINS_19y_combinator_resultISC_EEENS_5stateISt17integral_constantIiLi2EEZ5test0vE7nothingNS_6action10a_continueEEERKSJ_IiLi100EEJEEES3_S4_S6_S8_SB_EUlS5_E_EC2ISS_EES5_ 1302 | .cfi_endproc 1303 | 1304 | .align 16, 0x90 1305 | .type _ZNSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEC2ERSE_,@function 1306 | _ZNSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEC2ERSE_: # @"_ZNSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEC2ERSE_" 1307 | .cfi_startproc 1308 | # BB#0: 1309 | pushq %rbx 1310 | .Ltmp100: 1311 | .cfi_def_cfa_offset 16 1312 | .Ltmp101: 1313 | .cfi_offset %rbx, -16 1314 | movq %rdi, %rbx 1315 | movq %rsi, %rdi 1316 | callq _ZSt11__addressofIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEPS5_RS5_ 1317 | movq %rax, (%rbx) 1318 | popq %rbx 1319 | retq 1320 | .Lfunc_end58: 1321 | .size _ZNSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEC2ERSE_, .Lfunc_end58-_ZNSt17reference_wrapperIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEC2ERSE_ 1322 | .cfi_endproc 1323 | 1324 | .align 16, 0x90 1325 | .type _ZSt11__addressofIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEPS5_RS5_,@function 1326 | _ZSt11__addressofIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEPS5_RS5_: # @"_ZSt11__addressofIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEPS5_RS5_" 1327 | .cfi_startproc 1328 | # BB#0: 1329 | movq %rdi, %rax 1330 | retq 1331 | .Lfunc_end59: 1332 | .size _ZSt11__addressofIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEPS5_RS5_, .Lfunc_end59-_ZSt11__addressofIN4impl19y_combinator_resultIZ10static_forIZ5test0vE3$_0EDaOT_EUlS5_T0_OT1_DpOT2_E_EEEPS5_RS5_ 1333 | .cfi_endproc 1334 | 1335 | .type _ZL5int_vILi1EE,@object # @_ZL5int_vILi1EE 1336 | .section .rodata,"a",@progbits 1337 | _ZL5int_vILi1EE: 1338 | .zero 1 1339 | .size _ZL5int_vILi1EE, 1 1340 | 1341 | .type _ZL5int_vILi10EE,@object # @_ZL5int_vILi10EE 1342 | _ZL5int_vILi10EE: 1343 | .zero 1 1344 | .size _ZL5int_vILi10EE, 1 1345 | 1346 | .type _ZL5int_vILi100EE,@object # @_ZL5int_vILi100EE 1347 | _ZL5int_vILi100EE: 1348 | .zero 1 1349 | .size _ZL5int_vILi100EE, 1 1350 | 1351 | .type .L_ZZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_E13initial_state,@object # @"_ZZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_E13initial_state" 1352 | .L_ZZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_E13initial_state: 1353 | .zero 1 1354 | .size .L_ZZZZZ10static_forIZ5test0vE3$_0EDaOT_ENKUlS2_E_clIZ5test0vE7nothingEES1_S2_ENKUlDpOT_E_clIJRKSt17integral_constantIiLi1EERKSC_IiLi10EERKSC_IiLi100EEEEES1_S9_ENKUlS3_DpOT0_E_clIRKZS_IS0_ES1_S3_EUlS2_T0_OT1_DpOT2_E_JSF_SI_SL_EEES1_S3_SO_E13initial_state, 1 1355 | 1356 | 1357 | .ident "clang version 3.8.1 (tags/RELEASE_381/final)" 1358 | .section ".note.GNU-stack","",@progbits 1359 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/clang/staticfor_O2.s: -------------------------------------------------------------------------------- 1 | .text 2 | .file "staticfor.cpp" 3 | .globl _Z7consumeRVi 4 | .align 16, 0x90 5 | .type _Z7consumeRVi,@function 6 | _Z7consumeRVi: # @_Z7consumeRVi 7 | .cfi_startproc 8 | # BB#0: 9 | movl (%rdi), %eax 10 | retq 11 | .Lfunc_end0: 12 | .size _Z7consumeRVi, .Lfunc_end0-_Z7consumeRVi 13 | .cfi_endproc 14 | 15 | .globl _Z5test0v 16 | .align 16, 0x90 17 | .type _Z5test0v,@function 18 | _Z5test0v: # @_Z5test0v 19 | .cfi_startproc 20 | # BB#0: 21 | subq $24, %rsp 22 | .Ltmp0: 23 | .cfi_def_cfa_offset 32 24 | movq %fs:40, %rax 25 | movq %rax, 16(%rsp) 26 | movl $0, 12(%rsp) 27 | movl $1, 12(%rsp) 28 | movl 12(%rsp), %eax 29 | movl $10, 12(%rsp) 30 | movl 12(%rsp), %eax 31 | movl $100, 12(%rsp) 32 | movl 12(%rsp), %eax 33 | movl 12(%rsp), %eax 34 | movq %fs:40, %rcx 35 | cmpq 16(%rsp), %rcx 36 | jne .LBB1_2 37 | # BB#1: # %SP_return 38 | addq $24, %rsp 39 | retq 40 | .LBB1_2: # %CallStackCheckFailBlk 41 | callq __stack_chk_fail@PLT 42 | .Lfunc_end1: 43 | .size _Z5test0v, .Lfunc_end1-_Z5test0v 44 | .cfi_endproc 45 | 46 | .globl main 47 | .align 16, 0x90 48 | .type main,@function 49 | main: # @main 50 | .cfi_startproc 51 | # BB#0: 52 | subq $24, %rsp 53 | .Ltmp1: 54 | .cfi_def_cfa_offset 32 55 | movq %fs:40, %rax 56 | movq %rax, 16(%rsp) 57 | movl $0, 12(%rsp) 58 | movl $1, 12(%rsp) 59 | movl 12(%rsp), %eax 60 | movl $10, 12(%rsp) 61 | movl 12(%rsp), %eax 62 | movl $100, 12(%rsp) 63 | movl 12(%rsp), %eax 64 | movl 12(%rsp), %eax 65 | movl %eax, 8(%rsp) 66 | movl 8(%rsp), %eax 67 | movq %fs:40, %rcx 68 | cmpq 16(%rsp), %rcx 69 | jne .LBB2_2 70 | # BB#1: # %SP_return 71 | addq $24, %rsp 72 | retq 73 | .LBB2_2: # %CallStackCheckFailBlk 74 | callq __stack_chk_fail@PLT 75 | .Lfunc_end2: 76 | .size main, .Lfunc_end2-main 77 | .cfi_endproc 78 | 79 | 80 | .ident "clang version 3.8.1 (tags/RELEASE_381/final)" 81 | .section ".note.GNU-stack","",@progbits 82 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/clang/staticfor_O3.s: -------------------------------------------------------------------------------- 1 | .text 2 | .file "staticfor.cpp" 3 | .globl _Z7consumeRVi 4 | .align 16, 0x90 5 | .type _Z7consumeRVi,@function 6 | _Z7consumeRVi: # @_Z7consumeRVi 7 | .cfi_startproc 8 | # BB#0: 9 | movl (%rdi), %eax 10 | retq 11 | .Lfunc_end0: 12 | .size _Z7consumeRVi, .Lfunc_end0-_Z7consumeRVi 13 | .cfi_endproc 14 | 15 | .globl _Z5test0v 16 | .align 16, 0x90 17 | .type _Z5test0v,@function 18 | _Z5test0v: # @_Z5test0v 19 | .cfi_startproc 20 | # BB#0: 21 | subq $24, %rsp 22 | .Ltmp0: 23 | .cfi_def_cfa_offset 32 24 | movq %fs:40, %rax 25 | movq %rax, 16(%rsp) 26 | movl $0, 12(%rsp) 27 | movl $1, 12(%rsp) 28 | movl 12(%rsp), %eax 29 | movl $10, 12(%rsp) 30 | movl 12(%rsp), %eax 31 | movl $100, 12(%rsp) 32 | movl 12(%rsp), %eax 33 | movl 12(%rsp), %eax 34 | movq %fs:40, %rcx 35 | cmpq 16(%rsp), %rcx 36 | jne .LBB1_2 37 | # BB#1: # %SP_return 38 | addq $24, %rsp 39 | retq 40 | .LBB1_2: # %CallStackCheckFailBlk 41 | callq __stack_chk_fail@PLT 42 | .Lfunc_end1: 43 | .size _Z5test0v, .Lfunc_end1-_Z5test0v 44 | .cfi_endproc 45 | 46 | .globl main 47 | .align 16, 0x90 48 | .type main,@function 49 | main: # @main 50 | .cfi_startproc 51 | # BB#0: 52 | subq $24, %rsp 53 | .Ltmp1: 54 | .cfi_def_cfa_offset 32 55 | movq %fs:40, %rax 56 | movq %rax, 16(%rsp) 57 | movl $0, 12(%rsp) 58 | movl $1, 12(%rsp) 59 | movl 12(%rsp), %eax 60 | movl $10, 12(%rsp) 61 | movl 12(%rsp), %eax 62 | movl $100, 12(%rsp) 63 | movl 12(%rsp), %eax 64 | movl 12(%rsp), %eax 65 | movl %eax, 8(%rsp) 66 | movl 8(%rsp), %eax 67 | movq %fs:40, %rcx 68 | cmpq 16(%rsp), %rcx 69 | jne .LBB2_2 70 | # BB#1: # %SP_return 71 | addq $24, %rsp 72 | retq 73 | .LBB2_2: # %CallStackCheckFailBlk 74 | callq __stack_chk_fail@PLT 75 | .Lfunc_end2: 76 | .size main, .Lfunc_end2-main 77 | .cfi_endproc 78 | 79 | 80 | .ident "clang version 3.8.1 (tags/RELEASE_381/final)" 81 | .section ".note.GNU-stack","",@progbits 82 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/clang/traditional_O0.s: -------------------------------------------------------------------------------- 1 | .text 2 | .file "traditional.cpp" 3 | .globl _Z7consumeRVi 4 | .align 16, 0x90 5 | .type _Z7consumeRVi,@function 6 | _Z7consumeRVi: # @_Z7consumeRVi 7 | .cfi_startproc 8 | # BB#0: 9 | pushq %rbp 10 | .Ltmp0: 11 | .cfi_def_cfa_offset 16 12 | .Ltmp1: 13 | .cfi_offset %rbp, -16 14 | movq %rsp, %rbp 15 | .Ltmp2: 16 | .cfi_def_cfa_register %rbp 17 | movq %rdi, -8(%rbp) 18 | movq -8(%rbp), %rdi 19 | movl (%rdi), %eax 20 | popq %rbp 21 | retq 22 | .Lfunc_end0: 23 | .size _Z7consumeRVi, .Lfunc_end0-_Z7consumeRVi 24 | .cfi_endproc 25 | 26 | .globl _Z5test0v 27 | .align 16, 0x90 28 | .type _Z5test0v,@function 29 | _Z5test0v: # @_Z5test0v 30 | .cfi_startproc 31 | # BB#0: 32 | pushq %rbp 33 | .Ltmp3: 34 | .cfi_def_cfa_offset 16 35 | .Ltmp4: 36 | .cfi_offset %rbp, -16 37 | movq %rsp, %rbp 38 | .Ltmp5: 39 | .cfi_def_cfa_register %rbp 40 | subq $48, %rsp 41 | movq %fs:40, %rax 42 | movq %rax, -8(%rbp) 43 | movl $0, -12(%rbp) 44 | movl $1, -12(%rbp) 45 | leaq -12(%rbp), %rax 46 | movq %rax, %rdi 47 | movq %rax, -24(%rbp) # 8-byte Spill 48 | callq _Z7consumeRVi@PLT 49 | movl $10, -12(%rbp) 50 | movq -24(%rbp), %rdi # 8-byte Reload 51 | movl %eax, -28(%rbp) # 4-byte Spill 52 | callq _Z7consumeRVi@PLT 53 | movl $100, -12(%rbp) 54 | movq -24(%rbp), %rdi # 8-byte Reload 55 | movl %eax, -32(%rbp) # 4-byte Spill 56 | callq _Z7consumeRVi@PLT 57 | movl -12(%rbp), %ecx 58 | movq %fs:40, %rdi 59 | cmpq -8(%rbp), %rdi 60 | movl %eax, -36(%rbp) # 4-byte Spill 61 | movl %ecx, -40(%rbp) # 4-byte Spill 62 | jne .LBB1_2 63 | # BB#1: # %SP_return 64 | movl -40(%rbp), %eax # 4-byte Reload 65 | addq $48, %rsp 66 | popq %rbp 67 | retq 68 | .LBB1_2: # %CallStackCheckFailBlk 69 | callq __stack_chk_fail@PLT 70 | .Lfunc_end1: 71 | .size _Z5test0v, .Lfunc_end1-_Z5test0v 72 | .cfi_endproc 73 | 74 | .globl main 75 | .align 16, 0x90 76 | .type main,@function 77 | main: # @main 78 | .cfi_startproc 79 | # BB#0: 80 | pushq %rbp 81 | .Ltmp6: 82 | .cfi_def_cfa_offset 16 83 | .Ltmp7: 84 | .cfi_offset %rbp, -16 85 | movq %rsp, %rbp 86 | .Ltmp8: 87 | .cfi_def_cfa_register %rbp 88 | subq $16, %rsp 89 | movl $0, -4(%rbp) 90 | callq _Z5test0v@PLT 91 | movl %eax, -8(%rbp) 92 | movl -8(%rbp), %eax 93 | addq $16, %rsp 94 | popq %rbp 95 | retq 96 | .Lfunc_end2: 97 | .size main, .Lfunc_end2-main 98 | .cfi_endproc 99 | 100 | 101 | .ident "clang version 3.8.1 (tags/RELEASE_381/final)" 102 | .section ".note.GNU-stack","",@progbits 103 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/clang/traditional_O1.s: -------------------------------------------------------------------------------- 1 | .text 2 | .file "traditional.cpp" 3 | .globl _Z7consumeRVi 4 | .align 16, 0x90 5 | .type _Z7consumeRVi,@function 6 | _Z7consumeRVi: # @_Z7consumeRVi 7 | .cfi_startproc 8 | # BB#0: 9 | movl (%rdi), %eax 10 | retq 11 | .Lfunc_end0: 12 | .size _Z7consumeRVi, .Lfunc_end0-_Z7consumeRVi 13 | .cfi_endproc 14 | 15 | .globl _Z5test0v 16 | .align 16, 0x90 17 | .type _Z5test0v,@function 18 | _Z5test0v: # @_Z5test0v 19 | .cfi_startproc 20 | # BB#0: 21 | pushq %rbx 22 | .Ltmp0: 23 | .cfi_def_cfa_offset 16 24 | subq $16, %rsp 25 | .Ltmp1: 26 | .cfi_def_cfa_offset 32 27 | .Ltmp2: 28 | .cfi_offset %rbx, -16 29 | movq %fs:40, %rax 30 | movq %rax, 8(%rsp) 31 | movl $0, 4(%rsp) 32 | movl $1, 4(%rsp) 33 | leaq 4(%rsp), %rbx 34 | movq %rbx, %rdi 35 | callq _Z7consumeRVi@PLT 36 | movl $10, 4(%rsp) 37 | movq %rbx, %rdi 38 | callq _Z7consumeRVi@PLT 39 | movl $100, 4(%rsp) 40 | movq %rbx, %rdi 41 | callq _Z7consumeRVi@PLT 42 | movl 4(%rsp), %eax 43 | movq %fs:40, %rcx 44 | cmpq 8(%rsp), %rcx 45 | jne .LBB1_2 46 | # BB#1: # %SP_return 47 | addq $16, %rsp 48 | popq %rbx 49 | retq 50 | .LBB1_2: # %CallStackCheckFailBlk 51 | callq __stack_chk_fail@PLT 52 | .Lfunc_end1: 53 | .size _Z5test0v, .Lfunc_end1-_Z5test0v 54 | .cfi_endproc 55 | 56 | .globl main 57 | .align 16, 0x90 58 | .type main,@function 59 | main: # @main 60 | .cfi_startproc 61 | # BB#0: 62 | subq $24, %rsp 63 | .Ltmp3: 64 | .cfi_def_cfa_offset 32 65 | movq %fs:40, %rax 66 | movq %rax, 16(%rsp) 67 | callq _Z5test0v@PLT 68 | movl %eax, 12(%rsp) 69 | movl 12(%rsp), %eax 70 | movq %fs:40, %rcx 71 | cmpq 16(%rsp), %rcx 72 | jne .LBB2_2 73 | # BB#1: # %SP_return 74 | addq $24, %rsp 75 | retq 76 | .LBB2_2: # %CallStackCheckFailBlk 77 | callq __stack_chk_fail@PLT 78 | .Lfunc_end2: 79 | .size main, .Lfunc_end2-main 80 | .cfi_endproc 81 | 82 | 83 | .ident "clang version 3.8.1 (tags/RELEASE_381/final)" 84 | .section ".note.GNU-stack","",@progbits 85 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/clang/traditional_O2.s: -------------------------------------------------------------------------------- 1 | .text 2 | .file "traditional.cpp" 3 | .globl _Z7consumeRVi 4 | .align 16, 0x90 5 | .type _Z7consumeRVi,@function 6 | _Z7consumeRVi: # @_Z7consumeRVi 7 | .cfi_startproc 8 | # BB#0: 9 | movl (%rdi), %eax 10 | retq 11 | .Lfunc_end0: 12 | .size _Z7consumeRVi, .Lfunc_end0-_Z7consumeRVi 13 | .cfi_endproc 14 | 15 | .globl _Z5test0v 16 | .align 16, 0x90 17 | .type _Z5test0v,@function 18 | _Z5test0v: # @_Z5test0v 19 | .cfi_startproc 20 | # BB#0: 21 | subq $24, %rsp 22 | .Ltmp0: 23 | .cfi_def_cfa_offset 32 24 | movq %fs:40, %rax 25 | movq %rax, 16(%rsp) 26 | movl $0, 12(%rsp) 27 | movl $1, 12(%rsp) 28 | movl 12(%rsp), %eax 29 | movl $10, 12(%rsp) 30 | movl 12(%rsp), %eax 31 | movl $100, 12(%rsp) 32 | movl 12(%rsp), %eax 33 | movl 12(%rsp), %eax 34 | movq %fs:40, %rcx 35 | cmpq 16(%rsp), %rcx 36 | jne .LBB1_2 37 | # BB#1: # %SP_return 38 | addq $24, %rsp 39 | retq 40 | .LBB1_2: # %CallStackCheckFailBlk 41 | callq __stack_chk_fail@PLT 42 | .Lfunc_end1: 43 | .size _Z5test0v, .Lfunc_end1-_Z5test0v 44 | .cfi_endproc 45 | 46 | .globl main 47 | .align 16, 0x90 48 | .type main,@function 49 | main: # @main 50 | .cfi_startproc 51 | # BB#0: 52 | subq $24, %rsp 53 | .Ltmp1: 54 | .cfi_def_cfa_offset 32 55 | movq %fs:40, %rax 56 | movq %rax, 16(%rsp) 57 | movl $0, 12(%rsp) 58 | movl $1, 12(%rsp) 59 | movl 12(%rsp), %eax 60 | movl $10, 12(%rsp) 61 | movl 12(%rsp), %eax 62 | movl $100, 12(%rsp) 63 | movl 12(%rsp), %eax 64 | movl 12(%rsp), %eax 65 | movl %eax, 8(%rsp) 66 | movl 8(%rsp), %eax 67 | movq %fs:40, %rcx 68 | cmpq 16(%rsp), %rcx 69 | jne .LBB2_2 70 | # BB#1: # %SP_return 71 | addq $24, %rsp 72 | retq 73 | .LBB2_2: # %CallStackCheckFailBlk 74 | callq __stack_chk_fail@PLT 75 | .Lfunc_end2: 76 | .size main, .Lfunc_end2-main 77 | .cfi_endproc 78 | 79 | 80 | .ident "clang version 3.8.1 (tags/RELEASE_381/final)" 81 | .section ".note.GNU-stack","",@progbits 82 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/clang/traditional_O3.s: -------------------------------------------------------------------------------- 1 | .text 2 | .file "traditional.cpp" 3 | .globl _Z7consumeRVi 4 | .align 16, 0x90 5 | .type _Z7consumeRVi,@function 6 | _Z7consumeRVi: # @_Z7consumeRVi 7 | .cfi_startproc 8 | # BB#0: 9 | movl (%rdi), %eax 10 | retq 11 | .Lfunc_end0: 12 | .size _Z7consumeRVi, .Lfunc_end0-_Z7consumeRVi 13 | .cfi_endproc 14 | 15 | .globl _Z5test0v 16 | .align 16, 0x90 17 | .type _Z5test0v,@function 18 | _Z5test0v: # @_Z5test0v 19 | .cfi_startproc 20 | # BB#0: 21 | subq $24, %rsp 22 | .Ltmp0: 23 | .cfi_def_cfa_offset 32 24 | movq %fs:40, %rax 25 | movq %rax, 16(%rsp) 26 | movl $0, 12(%rsp) 27 | movl $1, 12(%rsp) 28 | movl 12(%rsp), %eax 29 | movl $10, 12(%rsp) 30 | movl 12(%rsp), %eax 31 | movl $100, 12(%rsp) 32 | movl 12(%rsp), %eax 33 | movl 12(%rsp), %eax 34 | movq %fs:40, %rcx 35 | cmpq 16(%rsp), %rcx 36 | jne .LBB1_2 37 | # BB#1: # %SP_return 38 | addq $24, %rsp 39 | retq 40 | .LBB1_2: # %CallStackCheckFailBlk 41 | callq __stack_chk_fail@PLT 42 | .Lfunc_end1: 43 | .size _Z5test0v, .Lfunc_end1-_Z5test0v 44 | .cfi_endproc 45 | 46 | .globl main 47 | .align 16, 0x90 48 | .type main,@function 49 | main: # @main 50 | .cfi_startproc 51 | # BB#0: 52 | subq $24, %rsp 53 | .Ltmp1: 54 | .cfi_def_cfa_offset 32 55 | movq %fs:40, %rax 56 | movq %rax, 16(%rsp) 57 | movl $0, 12(%rsp) 58 | movl $1, 12(%rsp) 59 | movl 12(%rsp), %eax 60 | movl $10, 12(%rsp) 61 | movl 12(%rsp), %eax 62 | movl $100, 12(%rsp) 63 | movl 12(%rsp), %eax 64 | movl 12(%rsp), %eax 65 | movl %eax, 8(%rsp) 66 | movl 8(%rsp), %eax 67 | movq %fs:40, %rcx 68 | cmpq 16(%rsp), %rcx 69 | jne .LBB2_2 70 | # BB#1: # %SP_return 71 | addq $24, %rsp 72 | retq 73 | .LBB2_2: # %CallStackCheckFailBlk 74 | callq __stack_chk_fail@PLT 75 | .Lfunc_end2: 76 | .size main, .Lfunc_end2-main 77 | .cfi_endproc 78 | 79 | 80 | .ident "clang version 3.8.1 (tags/RELEASE_381/final)" 81 | .section ".note.GNU-stack","",@progbits 82 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/gcc/staticfor_O1.s: -------------------------------------------------------------------------------- 1 | .file "staticfor.cpp" 2 | .text 3 | .globl _Z7consumeRVi 4 | .type _Z7consumeRVi, @function 5 | _Z7consumeRVi: 6 | .LFB1417: 7 | .cfi_startproc 8 | movl (%rdi), %eax 9 | ret 10 | .cfi_endproc 11 | .LFE1417: 12 | .size _Z7consumeRVi, .-_Z7consumeRVi 13 | .globl _Z5test0v 14 | .type _Z5test0v, @function 15 | _Z5test0v: 16 | .LFB1418: 17 | .cfi_startproc 18 | movl $0, -4(%rsp) 19 | movl $1, -4(%rsp) 20 | movl -4(%rsp), %eax 21 | movl $10, -4(%rsp) 22 | movl -4(%rsp), %eax 23 | movl $100, -4(%rsp) 24 | movl -4(%rsp), %eax 25 | movl -4(%rsp), %eax 26 | ret 27 | .cfi_endproc 28 | .LFE1418: 29 | .size _Z5test0v, .-_Z5test0v 30 | .globl main 31 | .type main, @function 32 | main: 33 | .LFB1497: 34 | .cfi_startproc 35 | leaq -4144(%rsp), %rsp 36 | orq $0, (%rsp) 37 | leaq 4128(%rsp), %rsp 38 | .cfi_def_cfa_offset 24 39 | call _Z5test0v 40 | movl %eax, 12(%rsp) 41 | movl 12(%rsp), %eax 42 | addq $16, %rsp 43 | .cfi_def_cfa_offset 8 44 | ret 45 | .cfi_endproc 46 | .LFE1497: 47 | .size main, .-main 48 | .ident "GCC: (GNU) 6.1.1 20160802" 49 | .section .note.GNU-stack,"",@progbits 50 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/gcc/staticfor_O2.s: -------------------------------------------------------------------------------- 1 | .file "staticfor.cpp" 2 | .text 3 | .p2align 4,,15 4 | .globl _Z7consumeRVi 5 | .type _Z7consumeRVi, @function 6 | _Z7consumeRVi: 7 | .LFB1417: 8 | .cfi_startproc 9 | movl (%rdi), %eax 10 | ret 11 | .cfi_endproc 12 | .LFE1417: 13 | .size _Z7consumeRVi, .-_Z7consumeRVi 14 | .p2align 4,,15 15 | .globl _Z5test0v 16 | .type _Z5test0v, @function 17 | _Z5test0v: 18 | .LFB1418: 19 | .cfi_startproc 20 | movl $0, -4(%rsp) 21 | movl $1, -4(%rsp) 22 | movl -4(%rsp), %eax 23 | movl $10, -4(%rsp) 24 | movl -4(%rsp), %eax 25 | movl $100, -4(%rsp) 26 | movl -4(%rsp), %eax 27 | movl -4(%rsp), %eax 28 | ret 29 | .cfi_endproc 30 | .LFE1418: 31 | .size _Z5test0v, .-_Z5test0v 32 | .section .text.startup,"ax",@progbits 33 | .p2align 4,,15 34 | .globl main 35 | .type main, @function 36 | main: 37 | .LFB1497: 38 | .cfi_startproc 39 | movl $0, -4(%rsp) 40 | movl $1, -4(%rsp) 41 | movl -4(%rsp), %eax 42 | movl $10, -4(%rsp) 43 | movl -4(%rsp), %eax 44 | movl $100, -4(%rsp) 45 | movl -4(%rsp), %eax 46 | movl -4(%rsp), %eax 47 | movl %eax, -8(%rsp) 48 | movl -8(%rsp), %eax 49 | ret 50 | .cfi_endproc 51 | .LFE1497: 52 | .size main, .-main 53 | .ident "GCC: (GNU) 6.1.1 20160802" 54 | .section .note.GNU-stack,"",@progbits 55 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/gcc/staticfor_O3.s: -------------------------------------------------------------------------------- 1 | .file "staticfor.cpp" 2 | .text 3 | .p2align 4,,15 4 | .globl _Z7consumeRVi 5 | .type _Z7consumeRVi, @function 6 | _Z7consumeRVi: 7 | .LFB1417: 8 | .cfi_startproc 9 | movl (%rdi), %eax 10 | ret 11 | .cfi_endproc 12 | .LFE1417: 13 | .size _Z7consumeRVi, .-_Z7consumeRVi 14 | .p2align 4,,15 15 | .globl _Z5test0v 16 | .type _Z5test0v, @function 17 | _Z5test0v: 18 | .LFB1418: 19 | .cfi_startproc 20 | movl $0, -4(%rsp) 21 | movl $1, -4(%rsp) 22 | movl -4(%rsp), %eax 23 | movl $10, -4(%rsp) 24 | movl -4(%rsp), %eax 25 | movl $100, -4(%rsp) 26 | movl -4(%rsp), %eax 27 | movl -4(%rsp), %eax 28 | ret 29 | .cfi_endproc 30 | .LFE1418: 31 | .size _Z5test0v, .-_Z5test0v 32 | .section .text.startup,"ax",@progbits 33 | .p2align 4,,15 34 | .globl main 35 | .type main, @function 36 | main: 37 | .LFB1497: 38 | .cfi_startproc 39 | movl $0, -4(%rsp) 40 | movl $1, -4(%rsp) 41 | movl -4(%rsp), %eax 42 | movl $10, -4(%rsp) 43 | movl -4(%rsp), %eax 44 | movl $100, -4(%rsp) 45 | movl -4(%rsp), %eax 46 | movl -4(%rsp), %eax 47 | movl %eax, -8(%rsp) 48 | movl -8(%rsp), %eax 49 | ret 50 | .cfi_endproc 51 | .LFE1497: 52 | .size main, .-main 53 | .ident "GCC: (GNU) 6.1.1 20160802" 54 | .section .note.GNU-stack,"",@progbits 55 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/gcc/traditional_O0.s: -------------------------------------------------------------------------------- 1 | .file "traditional.cpp" 2 | .section .rodata 3 | .type _ZStL19piecewise_construct, @object 4 | .size _ZStL19piecewise_construct, 1 5 | _ZStL19piecewise_construct: 6 | .zero 1 7 | .type _ZStL13allocator_arg, @object 8 | .size _ZStL13allocator_arg, 1 9 | _ZStL13allocator_arg: 10 | .zero 1 11 | .type _ZStL6ignore, @object 12 | .size _ZStL6ignore, 1 13 | _ZStL6ignore: 14 | .zero 1 15 | .text 16 | .globl _Z7consumeRVi 17 | .type _Z7consumeRVi, @function 18 | _Z7consumeRVi: 19 | .LFB1347: 20 | .cfi_startproc 21 | pushq %rbp 22 | .cfi_def_cfa_offset 16 23 | .cfi_offset 6, -16 24 | movq %rsp, %rbp 25 | .cfi_def_cfa_register 6 26 | movq %rdi, -8(%rbp) 27 | movq -8(%rbp), %rax 28 | movl (%rax), %eax 29 | popq %rbp 30 | .cfi_def_cfa 7, 8 31 | ret 32 | .cfi_endproc 33 | .LFE1347: 34 | .size _Z7consumeRVi, .-_Z7consumeRVi 35 | .globl _Z5test0v 36 | .type _Z5test0v, @function 37 | _Z5test0v: 38 | .LFB1348: 39 | .cfi_startproc 40 | pushq %rbp 41 | .cfi_def_cfa_offset 16 42 | .cfi_offset 6, -16 43 | movq %rsp, %rbp 44 | .cfi_def_cfa_register 6 45 | leaq -4144(%rsp), %rsp 46 | orq $0, (%rsp) 47 | leaq 4128(%rsp), %rsp 48 | movq %fs:40, %rax 49 | movq %rax, -8(%rbp) 50 | xorl %eax, %eax 51 | movl $0, -12(%rbp) 52 | movl $1, -12(%rbp) 53 | leaq -12(%rbp), %rax 54 | movq %rax, %rdi 55 | call _Z7consumeRVi 56 | movl $10, -12(%rbp) 57 | leaq -12(%rbp), %rax 58 | movq %rax, %rdi 59 | call _Z7consumeRVi 60 | movl $100, -12(%rbp) 61 | leaq -12(%rbp), %rax 62 | movq %rax, %rdi 63 | call _Z7consumeRVi 64 | movl -12(%rbp), %eax 65 | movq -8(%rbp), %rdx 66 | xorq %fs:40, %rdx 67 | je .L5 68 | call __stack_chk_fail@PLT 69 | .L5: 70 | leave 71 | .cfi_def_cfa 7, 8 72 | ret 73 | .cfi_endproc 74 | .LFE1348: 75 | .size _Z5test0v, .-_Z5test0v 76 | .globl main 77 | .type main, @function 78 | main: 79 | .LFB1349: 80 | .cfi_startproc 81 | pushq %rbp 82 | .cfi_def_cfa_offset 16 83 | .cfi_offset 6, -16 84 | movq %rsp, %rbp 85 | .cfi_def_cfa_register 6 86 | leaq -4144(%rsp), %rsp 87 | orq $0, (%rsp) 88 | leaq 4128(%rsp), %rsp 89 | call _Z5test0v 90 | movl %eax, -4(%rbp) 91 | movl -4(%rbp), %eax 92 | leave 93 | .cfi_def_cfa 7, 8 94 | ret 95 | .cfi_endproc 96 | .LFE1349: 97 | .size main, .-main 98 | .ident "GCC: (GNU) 6.1.1 20160802" 99 | .section .note.GNU-stack,"",@progbits 100 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/gcc/traditional_O1.s: -------------------------------------------------------------------------------- 1 | .file "traditional.cpp" 2 | .text 3 | .globl _Z7consumeRVi 4 | .type _Z7consumeRVi, @function 5 | _Z7consumeRVi: 6 | .LFB1417: 7 | .cfi_startproc 8 | movl (%rdi), %eax 9 | ret 10 | .cfi_endproc 11 | .LFE1417: 12 | .size _Z7consumeRVi, .-_Z7consumeRVi 13 | .globl _Z5test0v 14 | .type _Z5test0v, @function 15 | _Z5test0v: 16 | .LFB1418: 17 | .cfi_startproc 18 | movl $0, -4(%rsp) 19 | movl $1, -4(%rsp) 20 | movl -4(%rsp), %eax 21 | movl $10, -4(%rsp) 22 | movl -4(%rsp), %eax 23 | movl $100, -4(%rsp) 24 | movl -4(%rsp), %eax 25 | movl -4(%rsp), %eax 26 | ret 27 | .cfi_endproc 28 | .LFE1418: 29 | .size _Z5test0v, .-_Z5test0v 30 | .globl main 31 | .type main, @function 32 | main: 33 | .LFB1419: 34 | .cfi_startproc 35 | leaq -4144(%rsp), %rsp 36 | orq $0, (%rsp) 37 | leaq 4128(%rsp), %rsp 38 | .cfi_def_cfa_offset 24 39 | call _Z5test0v 40 | movl %eax, 12(%rsp) 41 | movl 12(%rsp), %eax 42 | addq $16, %rsp 43 | .cfi_def_cfa_offset 8 44 | ret 45 | .cfi_endproc 46 | .LFE1419: 47 | .size main, .-main 48 | .ident "GCC: (GNU) 6.1.1 20160802" 49 | .section .note.GNU-stack,"",@progbits 50 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/gcc/traditional_O2.s: -------------------------------------------------------------------------------- 1 | .file "traditional.cpp" 2 | .text 3 | .p2align 4,,15 4 | .globl _Z7consumeRVi 5 | .type _Z7consumeRVi, @function 6 | _Z7consumeRVi: 7 | .LFB1417: 8 | .cfi_startproc 9 | movl (%rdi), %eax 10 | ret 11 | .cfi_endproc 12 | .LFE1417: 13 | .size _Z7consumeRVi, .-_Z7consumeRVi 14 | .p2align 4,,15 15 | .globl _Z5test0v 16 | .type _Z5test0v, @function 17 | _Z5test0v: 18 | .LFB1418: 19 | .cfi_startproc 20 | movl $0, -4(%rsp) 21 | movl $1, -4(%rsp) 22 | movl -4(%rsp), %eax 23 | movl $10, -4(%rsp) 24 | movl -4(%rsp), %eax 25 | movl $100, -4(%rsp) 26 | movl -4(%rsp), %eax 27 | movl -4(%rsp), %eax 28 | ret 29 | .cfi_endproc 30 | .LFE1418: 31 | .size _Z5test0v, .-_Z5test0v 32 | .section .text.startup,"ax",@progbits 33 | .p2align 4,,15 34 | .globl main 35 | .type main, @function 36 | main: 37 | .LFB1419: 38 | .cfi_startproc 39 | movl $0, -4(%rsp) 40 | movl $1, -4(%rsp) 41 | movl -4(%rsp), %eax 42 | movl $10, -4(%rsp) 43 | movl -4(%rsp), %eax 44 | movl $100, -4(%rsp) 45 | movl -4(%rsp), %eax 46 | movl -4(%rsp), %eax 47 | movl %eax, -8(%rsp) 48 | movl -8(%rsp), %eax 49 | ret 50 | .cfi_endproc 51 | .LFE1419: 52 | .size main, .-main 53 | .ident "GCC: (GNU) 6.1.1 20160802" 54 | .section .note.GNU-stack,"",@progbits 55 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/gcc/traditional_O3.s: -------------------------------------------------------------------------------- 1 | .file "traditional.cpp" 2 | .text 3 | .p2align 4,,15 4 | .globl _Z7consumeRVi 5 | .type _Z7consumeRVi, @function 6 | _Z7consumeRVi: 7 | .LFB1417: 8 | .cfi_startproc 9 | movl (%rdi), %eax 10 | ret 11 | .cfi_endproc 12 | .LFE1417: 13 | .size _Z7consumeRVi, .-_Z7consumeRVi 14 | .p2align 4,,15 15 | .globl _Z5test0v 16 | .type _Z5test0v, @function 17 | _Z5test0v: 18 | .LFB1418: 19 | .cfi_startproc 20 | movl $0, -4(%rsp) 21 | movl $1, -4(%rsp) 22 | movl -4(%rsp), %eax 23 | movl $10, -4(%rsp) 24 | movl -4(%rsp), %eax 25 | movl $100, -4(%rsp) 26 | movl -4(%rsp), %eax 27 | movl -4(%rsp), %eax 28 | ret 29 | .cfi_endproc 30 | .LFE1418: 31 | .size _Z5test0v, .-_Z5test0v 32 | .section .text.startup,"ax",@progbits 33 | .p2align 4,,15 34 | .globl main 35 | .type main, @function 36 | main: 37 | .LFB1419: 38 | .cfi_startproc 39 | movl $0, -4(%rsp) 40 | movl $1, -4(%rsp) 41 | movl -4(%rsp), %eax 42 | movl $10, -4(%rsp) 43 | movl -4(%rsp), %eax 44 | movl $100, -4(%rsp) 45 | movl -4(%rsp), %eax 46 | movl -4(%rsp), %eax 47 | movl %eax, -8(%rsp) 48 | movl -8(%rsp), %eax 49 | ret 50 | .cfi_endproc 51 | .LFE1419: 52 | .size main, .-main 53 | .ident "GCC: (GNU) 6.1.1 20160802" 54 | .section .note.GNU-stack,"",@progbits 55 | -------------------------------------------------------------------------------- /static_control_flow/code/asm/staticfor.cpp: -------------------------------------------------------------------------------- 1 | #include "../impl/static_for.hpp" 2 | 3 | int consume(volatile int& x) 4 | { 5 | return x; 6 | } 7 | 8 | int test0() 9 | { 10 | struct nothing 11 | { 12 | }; 13 | 14 | volatile int i = 0; 15 | static_for([&i](auto state, auto x) 16 | { 17 | i = x; 18 | consume(i); 19 | return state.continue_(); 20 | })(nothing{})(int_v<1>, int_v<10>, int_v<100>); 21 | 22 | return i; 23 | } 24 | 25 | int main() 26 | { 27 | volatile int i0 = test0(); 28 | return i0; 29 | } -------------------------------------------------------------------------------- /static_control_flow/code/asm/traditional.cpp: -------------------------------------------------------------------------------- 1 | #include "../impl/static_for.hpp" 2 | 3 | int consume(volatile int& x) 4 | { 5 | return x; 6 | } 7 | 8 | int test0() 9 | { 10 | volatile int i = 0; 11 | 12 | i = 1; 13 | consume(i); 14 | 15 | i = 10; 16 | consume(i); 17 | 18 | i = 100; 19 | consume(i); 20 | 21 | return i; 22 | } 23 | 24 | int main() 25 | { 26 | volatile int i0 = test0(); 27 | return i0; 28 | } -------------------------------------------------------------------------------- /static_control_flow/code/cer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -std=c++14 -O0 \ 4 | -pedantic \ 5 | -W \ 6 | -Wall \ 7 | -Wextra \ 8 | -Wno-unused-local-typedefs \ 9 | -Wwrite-strings \ 10 | -Wundef \ 11 | -Wno-missing-field-initializers \ 12 | -Wpointer-arith \ 13 | -Wcast-align \ 14 | -Wno-unreachable-code \ 15 | -Wnon-virtual-dtor \ 16 | -Woverloaded-virtual \ 17 | -Wsuggest-final-types \ 18 | -Wsuggest-final-methods \ 19 | -Wsuggest-override \ 20 | -Wsuggest-attribute=pure \ 21 | -Wsuggest-attribute=const \ 22 | -Wsuggest-attribute=noreturn \ 23 | -Wsuggest-attribute=format \ 24 | -Wsequence-point \ 25 | -Wno-unused-but-set-parameter \ 26 | $1 -o /tmp/x.x && /tmp/x.x "${@:2}" -------------------------------------------------------------------------------- /static_control_flow/code/cerc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | clang++ -std=c++1z -O0 \ 4 | -pedantic \ 5 | -W \ 6 | -Wall \ 7 | -Wextra \ 8 | -Wno-unused-local-typedefs \ 9 | -Wwrite-strings \ 10 | -Wshadow \ 11 | -Wundef \ 12 | -Wno-missing-field-initializers \ 13 | -Wpointer-arith \ 14 | -Wcast-align \ 15 | -Wno-unreachable-code \ 16 | -Wnon-virtual-dtor \ 17 | -Woverloaded-virtual \ 18 | -Weverything \ 19 | -Wno-c++98-compat \ 20 | -Wno-c++98-compat-pedantic \ 21 | -Wno-missing-prototypes \ 22 | -Wno-newline-eof \ 23 | -Wno-reserved-id-macro \ 24 | -Wno-exit-time-destructors \ 25 | -Wno-global-constructors \ 26 | -Wno-missing-variable-declarations \ 27 | -Wno-header-hygiene \ 28 | -Wno-conversion \ 29 | -Wno-float-equal \ 30 | -Wno-old-style-cast \ 31 | -Wno-unused-macros \ 32 | -Wno-class-varargs \ 33 | -Wno-padded \ 34 | -Wno-weak-vtables \ 35 | -Wno-date-time \ 36 | -Wno-unneeded-member-function \ 37 | -Wno-covered-switch-default \ 38 | -Wno-range-loop-analysis \ 39 | $1 -o /tmp/x.x && /tmp/x.x "${@:2}" 40 | -------------------------------------------------------------------------------- /static_control_flow/code/extra/type_lists.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | 6 | 7 | #include 8 | #include 9 | #include 10 | #include "../impl/static_for.hpp" 11 | 12 | void example0() 13 | { 14 | auto list0 = std::make_tuple( // . 15 | sz_v<8>, sz_v<16>, sz_v<32>, sz_v<64>, sz_v<128> // . 16 | ); 17 | 18 | (void)list0; 19 | } 20 | 21 | // We can think of `std::tuple` as a compile-time list data structure. 22 | // Let's create a wrapper for readability. 23 | 24 | namespace mp 25 | { 26 | namespace list 27 | { 28 | template 29 | auto make(Ts...) 30 | { 31 | return std::make_tuple(Ts{}...); 32 | } 33 | } 34 | } 35 | 36 | void example1() 37 | { 38 | // Now it is clear that we're dealing with a compile-time list. 39 | auto list1 = mp::list::make( // . 40 | sz_v<8>, sz_v<16>, sz_v<32>, sz_v<64>, sz_v<128> // . 41 | ); 42 | 43 | (void)list1; 44 | } 45 | 46 | template 47 | void for_tuple(TF&& f, TTuple&& t) 48 | { 49 | auto adapted = [f = FWD(f)](auto&&... xs) 50 | { 51 | for_args(f, FWD(xs)...); 52 | }; 53 | 54 | std::experimental::apply(adapted, FWD(t)); 55 | } 56 | -------------------------------------------------------------------------------- /static_control_flow/code/extra/y_combinator.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | 6 | 7 | #include 8 | #include 9 | #include 10 | #include "../impl/static_if.hpp" 11 | #include "../impl/static_for_state.hpp" 12 | 13 | // As a final touch, we'll use a Y combinator to deal with lambda 14 | // recursion, as our current solution is not very elegant: 15 | /* 16 | else_([next_state, state, &xs...](auto&& xself) 17 | { 18 | // Recursive step. 19 | return xself(xself, next_state, xs...); 20 | })(self); 21 | */ 22 | 23 | // In short, the Y combinator is a fixed-point combinator that allows 24 | // to define recursion in lambda calculus. In practice, it allows to 25 | // implement recursion in C++ lambdas and functional programming 26 | // languages that do not natively support it. 27 | 28 | // Given a function that takes itself as a parameter to recurse, an 29 | // Y combinator will return a new function that will not require the 30 | // function to pass itself to itself. 31 | 32 | // Without Y combinator: 33 | /* 34 | auto factorial_impl = [](auto self, auto x) 35 | { 36 | if(x == 0) return 1; 37 | return self(self, x * self(x - 1)); 38 | }; 39 | 40 | auto factorial = [](auto x) 41 | { 42 | return factorial_impl(factorial_impl, x); 43 | }; 44 | 45 | auto fac10 = factorial(10); 46 | */ 47 | 48 | // With Y combinator: 49 | /* 50 | auto factorial_impl = [](auto self, auto x) 51 | { 52 | if(x == 0) return 1; 53 | return self(x * self(x - 1)); 54 | }; 55 | 56 | auto factorial = y_combinator(factorial_impl); 57 | auto fac10 = factorial(10); 58 | */ 59 | 60 | // The Y combinator can easily be implemented in C++14 using a struct 61 | // that stores the original function and adapts it by overloading 62 | // `operator()`. 63 | 64 | namespace impl 65 | { 66 | template 67 | class y_combinator_result 68 | { 69 | private: 70 | // `_f` is the original function. 71 | TF _f; 72 | 73 | public: 74 | template 75 | constexpr explicit y_combinator_result(T&& f) noexcept // . 76 | : _f(FWD(f)) 77 | { 78 | } 79 | 80 | // The overloaded `operator()` simply calls the original 81 | // function passing `ref(*this)` as the first parameter. 82 | template 83 | constexpr decltype(auto) operator()(Ts&&... xs) 84 | { 85 | return _f(std::ref(*this), FWD(xs)...); 86 | } 87 | }; 88 | } 89 | 90 | // The last thing we need is an interface function: 91 | template 92 | constexpr auto y_combinator(TF&& f) noexcept 93 | { 94 | return impl::y_combinator_result>(FWD(f)); 95 | } 96 | 97 | // Here's an example of how it works: 98 | void example0() 99 | { 100 | auto factorial_impl = [](auto self, auto x) -> int 101 | { 102 | if(x == 0) 103 | return 1; 104 | 105 | return self(x * self(x - 1)); 106 | }; 107 | 108 | auto factorial = y_combinator(factorial_impl); 109 | auto fac5 = factorial(5); 110 | 111 | /* 112 | factorial(5) -> yc(factorial_impl)(5 * yc(factorial_impl)(4)) 113 | yc(factorial_impl)(4) -> factorial_impl(yc(factorial_impl), 4) 114 | ... 115 | yc(factorial_impl)(0) -> factorial_impl(yc(factorial_impl), 0) 116 | factorial_impl(yc(factorial_impl), 0) -> 1 117 | */ 118 | 119 | (void)fac5; 120 | } 121 | 122 | // With our new `y_combinator`, we can clean up `static_for`: 123 | template 124 | auto static_for(TFBody&& body) 125 | { 126 | auto step = [body = FWD(body)]( 127 | auto self, auto state, auto&& x, auto&&... xs) 128 | { 129 | auto next_state = body(state, x); 130 | constexpr auto last_iteration = bool_v<(sizeof...(xs) == 0)>; 131 | 132 | constexpr auto must_break = bool_v<( // . 133 | std::is_same< // . 134 | decltype(next_state.next_action()), // . 135 | impl::action::a_break // . 136 | >{} // . 137 | )>; 138 | 139 | return static_if(bool_v<(must_break || last_iteration)>) 140 | .then([next_state](auto&&) 141 | { 142 | return next_state.accumulator(); 143 | }) 144 | .else_([next_state, state, &xs...](auto&& xself) 145 | { 146 | // vvvvv 147 | return xself(next_state, xs...); 148 | })(self); 149 | }; 150 | 151 | return [step = std::move(step)](auto accumulator) 152 | { 153 | return [step, accumulator](auto&&... xs) 154 | { 155 | return static_if(bool_v<(sizeof...(xs) == 0)>) 156 | .then([accumulator](auto&&) 157 | { 158 | return accumulator; 159 | }) 160 | .else_([accumulator](auto&& xstep, auto&&... ys) 161 | { 162 | auto initial_state = impl::make_state( // . 163 | sz_v<0>, // . 164 | accumulator, // . 165 | impl::action::a_continue{} // . 166 | ); 167 | 168 | // vvvvvvvvvvvvvvvvvvv 169 | return y_combinator(xstep)( // . 170 | initial_state, FWD(ys)...); 171 | })(step, FWD(xs)...); 172 | }; 173 | }; 174 | } 175 | 176 | // Some additional future improvements could include: 177 | // * Generic arity (take arguments N by N). 178 | // * Detect missing `return` and continue by default. 179 | // * Overload without any accumulation. 180 | 181 | int main() 182 | { 183 | auto result = // . 184 | static_for([](auto state, auto&& x) 185 | { 186 | std::cout // . 187 | << "Iteration (" << state.iteration() // . 188 | << ")\nValue (" << x // . 189 | << ")\nAccumulator (" << state.accumulator() // . 190 | << ")\n\n"; 191 | 192 | auto new_acc = sz_v<( // . 193 | decltype(state){}.accumulator() + decltype(x){} // . 194 | )>; 195 | 196 | return state.continue_(new_acc); 197 | })(sz_v<0>)(sz_v<10>, sz_v<20>, sz_v<30>, sz_v<40>); 198 | 199 | std::cout << "Result (" << result << ")\n"; 200 | } -------------------------------------------------------------------------------- /static_control_flow/code/impl/for_args.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | #pragma once 6 | 7 | #include "./static_if.hpp" 8 | 9 | template 10 | auto for_args(TF&& f, Ts&&... xs) 11 | { 12 | return (void)std::initializer_list{(f(FWD(xs)), 0)...}; 13 | } -------------------------------------------------------------------------------- /static_control_flow/code/impl/fwd.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #define FWD(...) ::std::forward(__VA_ARGS__) 10 | -------------------------------------------------------------------------------- /static_control_flow/code/impl/static_for.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | #pragma once 6 | 7 | #include "./for_args.hpp" 8 | #include "./y_combinator.hpp" 9 | #include "./static_if.hpp" 10 | #include "./static_for_state.hpp" 11 | 12 | template 13 | auto static_for(TFBody&& body) 14 | { 15 | auto step = [body = FWD(body)]( 16 | auto self, auto state, auto&& x, auto&&... xs) 17 | { 18 | auto next_state = body(state, x); 19 | 20 | constexpr auto last_iteration = bool_v<(sizeof...(xs) == 0)>; 21 | 22 | constexpr auto must_break = 23 | bool_v<(std::is_same{})>; 25 | 26 | return static_if(bool_v<(must_break || last_iteration)>) 27 | .then([next_state](auto&&) 28 | { 29 | return next_state.accumulator(); 30 | }) 31 | .else_([next_state, state, &xs...](auto&& xself) 32 | { 33 | return xself(next_state, xs...); 34 | })(self); 35 | }; 36 | 37 | return [step = std::move(step)](auto accumulator) 38 | { 39 | return [step, accumulator](auto&&... xs) 40 | { 41 | return static_if(bool_v<(sizeof...(xs) == 0)>) 42 | .then([accumulator](auto&&) 43 | { 44 | return accumulator; 45 | }) 46 | .else_([accumulator](auto&& xstep, auto&&... ys) 47 | { 48 | auto initial_state = impl::make_state( // . 49 | sz_v<0>, accumulator, impl::action::a_continue{}); 50 | 51 | return y_combinator(xstep)(initial_state, FWD(ys)...); 52 | })(step, FWD(xs)...); 53 | }; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /static_control_flow/code/impl/static_for_state.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | #pragma once 6 | 7 | #include "./static_if.hpp" 8 | 9 | namespace impl 10 | { 11 | namespace action 12 | { 13 | struct a_continue 14 | { 15 | }; 16 | 17 | struct a_break 18 | { 19 | }; 20 | } 21 | 22 | template 23 | struct state 24 | { 25 | constexpr auto iteration() const noexcept 26 | { 27 | return TItr{}; 28 | } 29 | 30 | constexpr auto accumulator() const noexcept 31 | { 32 | return TAcc{}; 33 | } 34 | 35 | constexpr auto next_action() const noexcept 36 | { 37 | return TAction{}; 38 | } 39 | 40 | template 41 | constexpr auto continue_(TNewAcc) const noexcept; 42 | 43 | constexpr auto continue_() const noexcept; 44 | 45 | template 46 | constexpr auto break_(TNewAcc) const noexcept; 47 | 48 | constexpr auto break_() const noexcept; 49 | }; 50 | 51 | template 52 | constexpr auto make_state(TItr, TAcc, TAction) 53 | { 54 | return state{}; 55 | } 56 | 57 | template 58 | constexpr auto advance_state(TState s, TAcc a, TAction na) 59 | { 60 | return make_state(sz_v, a, na); 61 | } 62 | 63 | template 64 | template 65 | constexpr auto state::continue_( // . 66 | TNewAcc new_acc) const noexcept 67 | { 68 | return advance_state(*this, new_acc, action::a_continue{}); 69 | } 70 | 71 | template 72 | constexpr auto state::continue_( // . 73 | ) const noexcept 74 | { 75 | return continue_(accumulator()); 76 | } 77 | 78 | template 79 | template 80 | constexpr auto state::break_( // . 81 | TNewAcc new_acc) const noexcept 82 | { 83 | return advance_state(*this, new_acc, action::a_break{}); 84 | } 85 | 86 | template 87 | constexpr auto state::break_( // . 88 | ) const noexcept 89 | { 90 | return break_(accumulator()); 91 | } 92 | } -------------------------------------------------------------------------------- /static_control_flow/code/impl/static_if.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | #pragma once 6 | 7 | #include "./fwd.hpp" 8 | 9 | template 10 | using bool_ = std::integral_constant; 11 | 12 | template 13 | constexpr bool_ bool_v{}; 14 | 15 | template 16 | using int_ = std::integral_constant; 17 | 18 | template 19 | constexpr int_ int_v{}; 20 | 21 | template 22 | using sz_ = std::integral_constant; 23 | 24 | template 25 | constexpr sz_ sz_v{}; 26 | 27 | template 28 | auto static_if(TPredicate) noexcept; 29 | 30 | namespace impl 31 | { 32 | template 33 | struct static_if_impl; 34 | 35 | template 36 | struct static_if_result; 37 | 38 | template 39 | auto make_static_if_result(TF&& f) noexcept; 40 | 41 | template <> 42 | struct static_if_impl 43 | { 44 | template 45 | auto& else_(TF&&) noexcept 46 | { 47 | // Ignore `else_`, as the predicate is true. 48 | return *this; 49 | } 50 | 51 | template 52 | auto& else_if(TPredicate) noexcept 53 | { 54 | // Ignore `else_if`, as the predicate is true. 55 | return *this; 56 | } 57 | 58 | template 59 | auto then(TF&& f) noexcept 60 | { 61 | // We found a matching branch, just make a result and 62 | // ignore everything else. 63 | return make_static_if_result(FWD(f)); 64 | } 65 | }; 66 | 67 | template <> 68 | struct static_if_impl 69 | { 70 | template 71 | auto& then(TF&&) noexcept 72 | { 73 | // Ignore `then`, as the predicate is false. 74 | return *this; 75 | } 76 | 77 | template 78 | auto else_(TF&& f) noexcept 79 | { 80 | // (Assuming that `else_` is after all `else_if` calls.) 81 | 82 | // We found a matching branch, just make a result and 83 | // ignore everything else. 84 | 85 | return make_static_if_result(FWD(f)); 86 | } 87 | 88 | template 89 | auto else_if(TPredicate) noexcept 90 | { 91 | return static_if(TPredicate{}); 92 | } 93 | 94 | template 95 | auto operator()(Ts&&...) noexcept 96 | { 97 | // If there are no `else` branches, we must ignore calls 98 | // to a failed `static_if` matching. 99 | } 100 | }; 101 | 102 | template 103 | struct static_if_result : TFunctionToCall 104 | { 105 | // Perfect-forward the function in the result instance. 106 | template 107 | static_if_result(TFFwd&& f) noexcept : TFunctionToCall(FWD(f)) 108 | { 109 | } 110 | 111 | // Ignore everything, we found a result. 112 | template 113 | auto& then(TF&&) noexcept 114 | { 115 | return *this; 116 | } 117 | 118 | template 119 | auto& else_if(TPredicate) noexcept 120 | { 121 | return *this; 122 | } 123 | 124 | template 125 | auto& else_(TF&&) noexcept 126 | { 127 | return *this; 128 | } 129 | }; 130 | 131 | template 132 | auto make_static_if_result(TF&& f) noexcept 133 | { 134 | return static_if_result{FWD(f)}; 135 | } 136 | } 137 | 138 | template 139 | auto static_if(TPredicate) noexcept 140 | { 141 | return impl::static_if_impl{}; 142 | } -------------------------------------------------------------------------------- /static_control_flow/code/impl/y_combinator.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace impl 10 | { 11 | template 12 | class y_combinator_result 13 | { 14 | private: 15 | TF _f; 16 | 17 | public: 18 | template 19 | inline constexpr explicit y_combinator_result(T&& f) noexcept 20 | : _f(FWD(f)) 21 | { 22 | } 23 | 24 | template 25 | inline constexpr decltype(auto) operator()(Ts&&... xs) 26 | { 27 | return _f(std::ref(*this), FWD(xs)...); 28 | } 29 | }; 30 | } 31 | 32 | template 33 | constexpr auto y_combinator(TF&& f) noexcept 34 | { 35 | return impl::y_combinator_result>(FWD(f)); 36 | } 37 | -------------------------------------------------------------------------------- /static_control_flow/code/p00.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `static_if` - usage example | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include 12 | #include "./impl/static_if.hpp" 13 | 14 | // Here's `static_if` in action: 15 | 16 | // clang-format off 17 | 18 | struct banana { void eat() { /* ... */ } }; 19 | struct peanuts { void eat() { /* ... */ } }; 20 | struct water { void drink() { /* ... */ } }; 21 | struct juice { void drink() { /* ... */ } }; 22 | 23 | template constexpr auto is_solid = bool_v; 24 | template <> constexpr auto is_solid = bool_v; 25 | template <> constexpr auto is_solid = bool_v; 26 | 27 | template constexpr auto is_liquid = bool_v; 28 | template <> constexpr auto is_liquid = bool_v; 29 | template <> constexpr auto is_liquid = bool_v; 30 | 31 | // clang-format on 32 | 33 | template 34 | auto consume(T&& x) 35 | { 36 | static_if(is_solid) 37 | .then([](auto&& y) 38 | { 39 | y.eat(); 40 | std::cout << "eating solid\n"; 41 | }) 42 | .else_if(is_liquid) 43 | .then([](auto&& y) 44 | { 45 | y.drink(); 46 | std::cout << "drinking liquid\n"; 47 | }) 48 | .else_([](auto&&) 49 | { 50 | std::cout << "cannot consume\n"; 51 | })(FWD(x)); 52 | } 53 | 54 | int main() 55 | { 56 | consume(banana{}); 57 | consume(water{}); 58 | consume(peanuts{}); 59 | consume(juice{}); 60 | consume(int{}); 61 | consume(float{}); 62 | } 63 | 64 | /* 65 | // The code above would look as follows in C++17: 66 | template 67 | auto consume(T&& x) 68 | { 69 | if constexpr(is_solid) 70 | { 71 | x.eat(); 72 | std::cout << "eating solid\n"; 73 | } 74 | else if constexpr(is_liquid) 75 | { 76 | x.drink(); 77 | std::cout << "drinking liquid\n"; 78 | } 79 | else 80 | { 81 | std::cout << "cannot consume\n"; 82 | } 83 | } 84 | */ -------------------------------------------------------------------------------- /static_control_flow/code/p01.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `static_if` - implementation | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include 12 | #include 13 | 14 | // Let's implement `static_if`. 15 | // Firstly, let's define some utility macros/aliases. 16 | 17 | // The `FWD` macro is a simple wrapper for `std::forward` that avoids 18 | // unnecessary repetition. 19 | #define FWD(...) ::std::forward(__VA_ARGS__) 20 | 21 | // To store boolean values in compile-time integral constants, we'll 22 | // use the `bool_` type alias... 23 | template 24 | using bool_ = std::integral_constant; 25 | 26 | // ...and the the `bool_v` variable template. 27 | template 28 | constexpr bool_ bool_v{}; 29 | 30 | // (Note that C++17 will introduce `bool_constant`). 31 | 32 | // My `static_if` implementation was inspired by this article, written 33 | // by Baptiste Wicht: 34 | // baptiste-wicht.com/posts/2015/07/simulate-static_if-with-c11c14.html 35 | 36 | // ...and the comments on its reddit thread: 37 | // reddit.com/r/cpp/comments/3d46ns/simulate_static_if_with_c11c14/ 38 | 39 | // ...and the following "CppCoreGuidelines" issue: 40 | // github.com/isocpp/CppCoreGuidelines/issues/353 41 | 42 | // The implementation is composed by the following elements: 43 | // 44 | // * An interface `static_if` function, that returns an instance of 45 | // an helper struct. 46 | // 47 | // * The helper `static_if_impl` struct, which will allow `then` and 48 | // `else_` chaining, and eventually return a "result" struct. 49 | // 50 | // * The result `static_if_result` struct, which will ignore other 51 | // chaining calls and execute the matched branch. 52 | 53 | // The interface function will be called `static_if` and will take an 54 | // integral boolean constant as a parameter. 55 | 56 | template 57 | auto static_if(TPredicate) noexcept; 58 | 59 | // We're passing `TPredicate` as a parameter, in line with the 60 | // type-value encoding style, to improve the syntax and allow type 61 | // deduction. 62 | 63 | // Our implementation will consist of a template struct that will be 64 | // specialized with the predicate's result. 65 | 66 | namespace impl 67 | { 68 | template 69 | struct static_if_impl; 70 | } 71 | 72 | // When calling `static_if`, we'll return a `static_if_impl` instance 73 | // that will allow the user to build the branching logic. 74 | 75 | // As soon as we find a matching branch, a `static_if_result` instance 76 | // will be returned and propagated through the branching hierarchy and 77 | // eventually call the correct function. 78 | 79 | namespace impl 80 | { 81 | template 82 | struct static_if_result; 83 | } 84 | 85 | // To reiterate: 86 | // 87 | // * `static_if_impl`: will be returned by the `static_if` interface 88 | // function. Every instance represents a branch. The type will be 89 | // specialized depending on whether or not the predicate is matched. 90 | // 91 | // * `static_if_result`: will ignore subsequent chaining methods and 92 | // will inherit from the branch lambda in order to be "callable". 93 | // Will be returned by `static_if_impl` if a `then` branch is 94 | // matched. 95 | // Will be returned by `static_if_impl` if an `else_` branch is 96 | // matched. 97 | 98 | // Let's implement `static_if_impl`: 99 | namespace impl 100 | { 101 | // This function will instantiate a `static_if_result`, by 102 | // forwarding `f` into it. 103 | // It will be called by the `static_if_impl` specializations when 104 | // a matching branch is reached. 105 | template 106 | auto make_static_if_result(TF&& f) noexcept; 107 | 108 | // `true` specialization. 109 | // Will give a "result" when a `then` branch is matched. 110 | template <> 111 | struct static_if_impl 112 | { 113 | template 114 | auto& else_(TF&&) noexcept 115 | { 116 | // Ignore `else_`, as the predicate is true. 117 | return *this; 118 | } 119 | 120 | template 121 | auto& else_if(TPredicate) noexcept 122 | { 123 | // Ignore `else_if`, as the predicate is true. 124 | return *this; 125 | } 126 | 127 | template 128 | auto then(TF&& f) noexcept 129 | { 130 | // We found a matching branch, just make a result and 131 | // ignore everything else. 132 | return make_static_if_result(FWD(f)); 133 | } 134 | }; 135 | 136 | // `false` specialization. 137 | // Will give a "result" when an `else_` branch is matched. 138 | // Will return a `static_if` when an `else_if` branch is matched. 139 | // It will also provide a "dummy" call operator that will handle 140 | // the case of a `static_if` without an `else_` branch. 141 | template <> 142 | struct static_if_impl 143 | { 144 | template 145 | auto& then(TF&&) noexcept 146 | { 147 | // Ignore `then`, as the predicate is false. 148 | return *this; 149 | } 150 | 151 | template 152 | auto else_(TF&& f) noexcept 153 | { 154 | // Assumes that `else_` is after all `else_if` calls. 155 | 156 | // (Checking that the branching is well-formed was not 157 | // implemented for this talk.) 158 | 159 | // We found a matching branch, just make a result and 160 | // ignore everything else. 161 | 162 | return make_static_if_result(FWD(f)); 163 | } 164 | 165 | template 166 | auto else_if(TPredicate) noexcept 167 | { 168 | return static_if(TPredicate{}); 169 | } 170 | 171 | template 172 | auto operator()(Ts&&...) noexcept 173 | { 174 | // If there are no `else` branches, we must ignore calls 175 | // to a failed `static_if` matching. 176 | } 177 | }; 178 | } 179 | 180 | // The last piece we need to complete our `static_if` implementation 181 | // is `static_if_result`. 182 | 183 | namespace impl 184 | { 185 | // The result struct will inherit from `TFunctionToCall`, so that 186 | // the final call operator in the user code will actually call the 187 | // matched branch body. 188 | template 189 | struct static_if_result : TFunctionToCall 190 | { 191 | // Perfectly-forward the function in the result instance. 192 | template 193 | static_if_result(TFFwd&& f) noexcept : TFunctionToCall(FWD(f)) 194 | { 195 | } 196 | 197 | // Ignore everything, we found a result. 198 | template 199 | auto& then(TF&&) noexcept 200 | { 201 | return *this; 202 | } 203 | 204 | template 205 | auto& else_if(TPredicate) noexcept 206 | { 207 | return *this; 208 | } 209 | 210 | template 211 | auto& else_(TF&&) noexcept 212 | { 213 | return *this; 214 | } 215 | }; 216 | 217 | template 218 | auto make_static_if_result(TF&& f) noexcept 219 | { 220 | return static_if_result{FWD(f)}; 221 | } 222 | } 223 | 224 | template 225 | auto static_if(TPredicate) noexcept 226 | { 227 | return impl::static_if_impl{}; 228 | } 229 | 230 | // Let's see some additional examples in the next code segment. 231 | 232 | int main() 233 | { 234 | } 235 | -------------------------------------------------------------------------------- /static_control_flow/code/p02.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `static_if` - more examples | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include "./impl/static_if.hpp" 12 | 13 | // Here's an additional example of something I've encountered during 14 | // coding: I was writing a resizable generic buffer, and had to deal 15 | // with movable types in a particular way: 16 | 17 | template 18 | void grow(std::size_t old_capacity, std::size_t /* new_capacity */) 19 | { 20 | /* 21 | assert(old_capacity <= new_capacity); 22 | auto new_data( 23 | allocator_traits::allocate(_allocator, new_capacity)); 24 | */ 25 | 26 | T* old_data; 27 | T* new_data; 28 | 29 | // Move existing items to new data. 30 | for(std::size_t i(0); i < old_capacity; ++i) 31 | { 32 | static_if(std::is_move_constructible{}) 33 | .then([&](auto& xold_data) 34 | { 35 | /* ++moves; */ 36 | new(&new_data[i]) T(std::move(xold_data[i])); 37 | }) 38 | .else_([&](auto& xold_data) 39 | { 40 | /* ++copies; */ 41 | new(&new_data[i]) T(xold_data[i]); 42 | })(old_data); 43 | } 44 | 45 | /* 46 | destroy_and_deallocate(old_capacity); 47 | _data = new_data; 48 | */ 49 | } 50 | 51 | // `static_if` is also extremely useful when writing compile-time 52 | // data structures using the "type-value encoding" paradigm. 53 | 54 | // Here's part of a compile-time "left fold" implementation that makes 55 | // use of `static_if` to stop the recursion. 56 | 57 | template 58 | auto foldl_step(TList ll) 59 | { 60 | return [=](auto self, auto y_curr, auto yi, auto... yis) 61 | { 62 | // Compute next folding step. 63 | auto next_acc( // . 64 | f(yi, y_curr, at(std::get(ll), yi)...) // . 65 | ); 66 | 67 | // Check if there are any more items inside the list. 68 | return static_if(bool_v<(sizeof...(yis) > 0)>) 69 | .then([=](auto z_self) 70 | { 71 | // Recursive case. 72 | return z_self(next_acc, yis...); 73 | }) 74 | .else_([=](auto) 75 | { 76 | // Base case. 77 | return next_acc; 78 | })(self); 79 | }; 80 | } 81 | 82 | // Being able to branch in an "almost imperative" way at compile-time 83 | // is extremely useful and superior (in terms of convencience and 84 | // readability) to explicit template specialization in many contexts. 85 | 86 | // Another common operation in imperative code is the "for each" loop. 87 | // Let's see how we could implement something similar at compile-time 88 | // in the next code segment. 89 | 90 | int main() 91 | { 92 | } -------------------------------------------------------------------------------- /static_control_flow/code/p03.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `for_args` - implementation | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include 12 | #include "./impl/fwd.hpp" 13 | 14 | // One possible starting point for a compile-time "for each" loop 15 | // is the famous `for_each_argument` snippet, originally posted on 16 | // Twitter by Sean Parent. 17 | 18 | // I've analyzed it at CppCon 2015: 19 | // https://www.youtube.com/watch?v=2l83JlqkzBk 20 | // ("`for_each_argument` explained and expanded") 21 | 22 | // Here's its implementation and a quick example: 23 | template 24 | auto for_args(TF&& f, Ts&&... xs) 25 | { 26 | // We use an `initializer_list` to create a context where variadic 27 | // parameter expansion can take place. 28 | return (void)std::initializer_list{ 29 | // Every element of the `initializer_list` is an expression 30 | // enclosed in round parenthesis. 31 | ( 32 | // In the parenthesis, the result of the `f` function call 33 | // is followed by the comma operator and an integer (zero 34 | // in this case). 35 | 36 | f(FWD(xs)), 37 | 38 | // Thanks to the comma operator, the expression evaluates 39 | // to an (unused) integer, which is accepted by the 40 | // `initializer_list`. 41 | 42 | 0)...}; 43 | } 44 | 45 | /* 46 | // The following `for_args` call... 47 | 48 | for_args 49 | ( 50 | [](const auto& x){ std::cout << x << " "; }, 51 | "hello", 52 | 1, 53 | 2, 54 | 3 55 | ); 56 | 57 | // ..roughly expands to... 58 | 59 | (void) std::initializer_list 60 | { 61 | ([](const auto& x){ std::cout << x; }("hello"), 0), 62 | ([](const auto& x){ std::cout << x; }(1), 0), 63 | ([](const auto& x){ std::cout << x; }(2), 0), 64 | ([](const auto& x){ std::cout << x; }(3), 0) 65 | } 66 | 67 | // ...which is the same as writing... 68 | 69 | std::cout << "hello"; 70 | std::cout << 1; 71 | std::cout << 2; 72 | std::cout << 3; 73 | */ 74 | 75 | int main() 76 | { 77 | // Prints "hello 1 2 3". 78 | for_args( 79 | [](const auto& x) 80 | { 81 | std::cout << x << " "; 82 | }, 83 | "hello", 1, 2, 3); 84 | 85 | std::cout << "\n"; 86 | } 87 | 88 | // Thanks to C++17 "fold expressions", implementing `for_args` will 89 | // be much more clean and straightforward: 90 | /* 91 | template 92 | void for_args_cpp17(TF&& f, Ts&&... xs) 93 | { 94 | (f(FWD(xs)), ...); 95 | } 96 | */ 97 | 98 | // Learn more about "fold expressions": 99 | // en.cppreference.com/w/cpp/language/fold 100 | 101 | // In the next code segment we'll exploit `for_args` for compile-time 102 | // iteration. -------------------------------------------------------------------------------- /static_control_flow/code/p04.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `for_args` - usage example | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include 12 | #include "./impl/fwd.hpp" 13 | 14 | template 15 | auto for_args(TF&& f, Ts&&... xs) 16 | { 17 | return (void)std::initializer_list{(f(FWD(xs)), 0)...}; 18 | } 19 | 20 | // Let's say we have a template `buffer` struct that takes a number 21 | // of bytes as a template parameter: 22 | template 23 | struct buffer 24 | { 25 | void allocate() 26 | { 27 | std::cout << "allocating " << TBytes << "\n"; 28 | } 29 | 30 | void deallocate() 31 | { 32 | std::cout << "deallocating " << TBytes << "\n"; 33 | } 34 | }; 35 | 36 | // We would like to run some tests with different amount of bytes. 37 | // If the byte count was a run-time parameter, we could do something 38 | // similar to this: 39 | /* 40 | void run_runtime_tests() 41 | { 42 | for(std::size_t n : {8, 16, 32, 64, 128, 256, 512, 1024}) 43 | { 44 | runtime_buffer b{n}; 45 | 46 | b.allocate(); 47 | perform_test(b); 48 | b.deallocate(); 49 | } 50 | } 51 | */ 52 | 53 | // The above code snippet is very clear and straightforward... it 54 | // would be nice to be able to do the same for a compile-time buffer. 55 | 56 | // Turns out we can, thanks to "type-value encoding". 57 | // Remember the `bool_v` constexpr template variable? 58 | // We can do the same with `std::size_t`. 59 | 60 | template 61 | using sz_ = std::integral_constant; 62 | 63 | template 64 | constexpr sz_ sz_v{}; 65 | 66 | // We now have a way of wrapping arbitrary `std::size_t` in unique 67 | // compile-time types. 68 | 69 | // Using `for_args` we can iterate over those values: 70 | void run_compiletime_tests() 71 | { 72 | for_args( 73 | [](auto n) 74 | { 75 | buffer b; 76 | 77 | b.allocate(); 78 | // perform_test(b); 79 | b.deallocate(); 80 | }, 81 | sz_v<8>, sz_v<16>, sz_v<32>, sz_v<64>, sz_v<128>, // . 82 | sz_v<256>, sz_v<512>, sz_v<1024>); 83 | } 84 | 85 | // It's not as pretty as the run-time version, but the code is very 86 | // clear and readable. It is easy to see that we're iterating over 87 | // a series of values and performing an action on them. 88 | 89 | // With some additional abstractions, the code could look like this: 90 | /* 91 | void run_compiletime_tests() 92 | { 93 | for_values( 94 | [](auto n) 95 | { 96 | buffer b; 97 | 98 | b.allocate(); 99 | // perform_test(b); 100 | b.deallocate(); 101 | }); 102 | } 103 | */ 104 | 105 | // In the next code segment, we'll see how `static_if` and `for_args` 106 | // work well together. 107 | 108 | int main() 109 | { 110 | run_compiletime_tests(); 111 | } -------------------------------------------------------------------------------- /static_control_flow/code/p05.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `for_args` + `static_if` | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include 12 | #include 13 | #include 14 | #include "./impl/static_if.hpp" 15 | #include "./impl/for_args.hpp" 16 | 17 | // In this code segment we'll implement a simple example that shows 18 | // how powerful `for_args` can be when combined with the previously 19 | // implemented `static_if`. 20 | 21 | // Something we often want to do is iterate over types or manipulate 22 | // types directly. We need to somehow find a way to pass types as 23 | // values. 24 | 25 | // To solve the issue, we can define a `type` that wraps a type 26 | // in a value we can easily manipulate. 27 | 28 | template 29 | struct type_ 30 | { 31 | using type = T; 32 | }; 33 | 34 | template 35 | constexpr type_ type{}; 36 | 37 | // Think of `type` as an `std::integral_constant` intended for 38 | // types instead of values. 39 | 40 | // To unwrap the stored type, we'll define an `unwrap` type alias: 41 | template 42 | using unwrap = typename T::type; 43 | 44 | // Let's use `type` and `for_args` to instantiate various types 45 | // and execute a test function with them: 46 | void example0() 47 | { 48 | // Example: manipulating several buffers at once. 49 | 50 | std::tuple< // . 51 | std::vector, // . 52 | std::vector, // . 53 | std::vector // . 54 | > buffers; 55 | 56 | auto resize_all_buffers = [&buffers](auto new_size) 57 | { 58 | for_args( 59 | [&buffers, new_size](auto t) 60 | { 61 | using unwrapped = unwrap; 62 | using vector_type = std::vector; 63 | 64 | std::get(buffers).resize(new_size); 65 | }, 66 | type, type, type); 67 | }; 68 | 69 | resize_all_buffers(100); 70 | } 71 | 72 | // Example - combining this functionality with `static_if`: 73 | void example1() 74 | { 75 | // Example: calling diffrent functions depending on a type size 76 | // threshold. 77 | 78 | auto init_small_object_storage = [](auto) 79 | { /* ... */ }; 80 | 81 | auto init_big_object_storage = [](auto) 82 | { /* ... */ }; 83 | 84 | for_args( 85 | [&](auto t) 86 | { 87 | using unwrapped = unwrap; 88 | 89 | static_if(bool_v<(sizeof(unwrapped) < 16)>) 90 | .then([&] 91 | { 92 | init_small_object_storage(t); 93 | }) 94 | .else_([&] 95 | { 96 | init_big_object_storage(t); 97 | })(); 98 | }, 99 | type, type, type, // . 100 | type>); 101 | } 102 | 103 | int main() 104 | { 105 | example0(); 106 | example1(); 107 | } 108 | 109 | // Iterating over a compile-time collection using `for_args` has, 110 | // however, many annoying limitations: 111 | /* 112 | * It is not possible to get the current iteration index. 113 | 114 | * It is not possible to produce a result value. 115 | 116 | * No `break` and `continue`. 117 | */ 118 | 119 | // Let's look at a complete compile-time `for...each` loop counterpart 120 | // in the next code segment, which can be entirely implemented in 121 | // C++14. -------------------------------------------------------------------------------- /static_control_flow/code/p06.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `static_for` - usage example | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include 12 | #include 13 | #include "./impl/static_if.hpp" 14 | #include "./impl/static_for.hpp" 15 | 16 | // `static_for`, compared to `for_args`, will add the following 17 | // features: 18 | /* 19 | * Access to the current iteration index. 20 | 21 | * Possibility to produce an output value (accumulator). 22 | 23 | * Intuitive `break` and `continue` constructs. 24 | */ 25 | 26 | // (One possible drawback is, however, a bigger impact on compilation 27 | // times, as the implementation requires recursion.) 28 | 29 | // Before diving into `static_for`'s implementation, let's take a 30 | // look at an example. 31 | 32 | // In the example, we'll write a `static_for` that will: 33 | // * Accept any number of compile-time numerical values. 34 | // * Accumulate the numbers and return the result at compile-time. 35 | // * Print every even number and iteration. 36 | // * Immediately break when `-999` is encountered. 37 | 38 | void example0() 39 | { 40 | // `static_for` works by passing its current "state" as a 41 | // parameter to the loop body every iteration. 42 | 43 | // The "state" contains: 44 | // * The current iteration as compile-time number. 45 | // * The next action to execute ("break" or "continue"). 46 | // * An accumulator variable that can be used for compile-time 47 | // computations. 48 | 49 | // Calling `static_for` with a loop body does not immediately 50 | // start the execution: a new function is returned that can be 51 | // called to bind an initial accumulator value and then called 52 | // again to start the execution on some arguments. 53 | 54 | auto print_even_and_accumulate = static_for( // . 55 | [](auto state, auto x) 56 | { 57 | // GCC does not like when `state` and `x` are used inside 58 | // constant expressions such as `sz_v<...>`. Therefore, 59 | // we need to re-istantiate them as `constexpr` variables. 60 | constexpr auto ce_state = decltype(state){}; 61 | constexpr auto ce_x = decltype(x){}; 62 | 63 | // For readability, we assign a name to our predicates. 64 | constexpr auto must_break = bool_v<(x == -999)>; 65 | constexpr auto even = bool_v<(x % 2 == 0)>; 66 | 67 | return static_if(must_break) 68 | .then([&]() 69 | { 70 | // If `x` is `-999`, we immediately break. 71 | return state.break_(); 72 | }) 73 | .else_([&]() 74 | { 75 | // Otherwise, we print some info if the number 76 | // is even... 77 | static_if(even).then([&] 78 | { 79 | std::cout // . 80 | << "Iteration (" // . 81 | << state.iteration() // . 82 | << ") - even number: " // . 83 | << x << "\n"; 84 | })(); 85 | 86 | // ...and continue the iteration by adding 87 | // the current value to the accumulator. 88 | return state.continue_( // . 89 | sz_v); 90 | })(); 91 | }); 92 | 93 | // Note that, while the iteration and the produced result value 94 | // both occur at compile-time, run-time side effects can be 95 | // inserted into the loop body. Think of `static_for` as a code 96 | // generator. 97 | 98 | // The above `static_for` is roughly equivalent to this run-time 99 | // loop generator: 100 | auto print_even_and_accumulate_runtime = [](auto accumulator) 101 | { 102 | return [accumulator](auto... xs) mutable 103 | { 104 | int iteration = 0; 105 | for(auto x : std::vector{xs...}) 106 | { 107 | if(x == -999) 108 | { 109 | break; 110 | } 111 | else if(x % 2 == 0) 112 | { 113 | std::cout // . 114 | << "Iteration (" << iteration 115 | << ") - even number: " << x << "\n"; 116 | } 117 | 118 | accumulator += x; 119 | ++iteration; 120 | } 121 | 122 | return accumulator; 123 | }; 124 | }; 125 | 126 | // First return: 127 | // Calling `static_for(body)` simply returns a wrapper for `body` 128 | // that can be called again two times. 129 | 130 | // Second return: 131 | // Calling `static_for(body)(initial_accumulator)` returns a 132 | // function that, when called with a variadic number of arguments, 133 | // executes the loop body using `initial_accumulator` as the 134 | // initial accumulator value. 135 | 136 | // Third return: 137 | // Calling `static_for(body)(initial_accumulator)(xs...)` returns 138 | // the final accumulator value after executing the loop body over 139 | // every argument inside the `xs...` pack. 140 | 141 | // Example: we bind `0` as the initial accumulator value. 142 | auto peaa_from_zero = print_even_and_accumulate(sz_v<0>); 143 | 144 | // Then we execute the loop and store the final result in `r0`. 145 | auto ct_r0 = peaa_from_zero(sz_v<5>, sz_v<4>, sz_v<15>, sz_v<35>); 146 | std::cout << "Compile-time result: " << ct_r0 << "\n\n"; 147 | 148 | // We'll also execute the run-time loop and check for equality: 149 | auto rt_r0 = print_even_and_accumulate_runtime(0)(5, 4, 15, 35); 150 | std::cout << "Run-time result: " << rt_r0 << "\n\n"; 151 | 152 | if(ct_r0 == rt_r0) 153 | { 154 | std::cout << "OK!\n"; 155 | } 156 | } 157 | 158 | // Let's implement `static_for` from scratch in the next code segment. 159 | 160 | int main() 161 | { 162 | example0(); 163 | } -------------------------------------------------------------------------------- /static_control_flow/code/p07.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | `static_for` - implementation | 8 | // | | 9 | // +-----------------------------------------------+ 10 | 11 | #include 12 | #include "./impl/static_if.hpp" 13 | 14 | // Let's think of what we require to implement `static_for`: 15 | // 16 | // * A `state` class that keeps track of: 17 | // * Current iteration. 18 | // * Current accumulator. 19 | // * Next action (break or continue). 20 | // 21 | // > The iteration will be tracked using an integral constant. 22 | // 23 | // > The accumulator will be provided by the user code. 24 | // 25 | // > The next action will be implemented using two empty "tag" 26 | // structs. 27 | // 28 | // * We need to "iterate" at compile-time: this can be implemented 29 | // using recursion. 30 | 31 | // Let's begin by implementing the action classes: 32 | namespace impl 33 | { 34 | namespace action 35 | { 36 | struct a_continue 37 | { 38 | }; 39 | 40 | struct a_break 41 | { 42 | }; 43 | } 44 | } 45 | 46 | // Now, let's implement that `state` class. 47 | // The stored "state" has to be accessible at compile-time, therefore 48 | // we'll use templates and `constexpr`. 49 | 50 | namespace impl 51 | { 52 | template 53 | struct state 54 | { 55 | // The user-provided loop body will make use of the following 56 | // methods to access and modify the state. 57 | 58 | constexpr auto iteration() const noexcept 59 | { 60 | return TItr{}; 61 | } 62 | 63 | constexpr auto accumulator() const noexcept 64 | { 65 | return TAcc{}; 66 | } 67 | 68 | constexpr auto next_action() const noexcept 69 | { 70 | return TAction{}; 71 | } 72 | 73 | // The `continue_` method will return a new state, with an 74 | // incremented iteration counter and a new accumulator value. 75 | template 76 | constexpr auto continue_(TNewAcc) const noexcept; 77 | 78 | // In case the user does not care about the accumulation 79 | // feature, we provide an overload that does not change the 80 | // current accumulated value. 81 | constexpr auto continue_() const noexcept; 82 | 83 | // The `break_` method will return a new state, with the 84 | // `actions::a_break` next action, which will signal the loop 85 | // to stop before the next iteration. In case the user wants 86 | // to "immediately return" a final value, a new accumulator 87 | // value can be passed. 88 | template 89 | constexpr auto break_(TNewAcc) const noexcept; 90 | 91 | // A zero-parameter overload will be provided here as well. 92 | constexpr auto break_() const noexcept; 93 | }; 94 | } 95 | 96 | // To simplify the management of the `state` in the implementation 97 | // code, we'll define some helper functions: 98 | namespace impl 99 | { 100 | // The `make_state` function will make use of type deduction to 101 | // provide a "type-value encoding"-friendly interface for state 102 | // creation. 103 | 104 | template 105 | constexpr auto make_state(TItr, TAcc, TAction) 106 | { 107 | return state{}; 108 | } 109 | 110 | // The `advance_state` function will, given a state, return a new 111 | // one with an increased iteration count, a new accumulator and a 112 | // new next action. 113 | 114 | template 115 | constexpr auto advance_state(TState s, TAcc a, TAction na) 116 | { 117 | return make_state(sz_v, a, na); 118 | } 119 | } 120 | 121 | // We can now provide a definition for `state`'s methods: 122 | namespace impl 123 | { 124 | template 125 | template 126 | constexpr auto state::continue_( // . 127 | TNewAcc new_acc) const noexcept 128 | { 129 | return advance_state(*this, new_acc, action::a_continue{}); 130 | } 131 | 132 | template 133 | constexpr auto state::continue_( // . 134 | ) const noexcept 135 | { 136 | return continue_(accumulator()); 137 | } 138 | 139 | template 140 | template 141 | constexpr auto state::break_( // . 142 | TNewAcc new_acc) const noexcept 143 | { 144 | return advance_state(*this, new_acc, action::a_break{}); 145 | } 146 | 147 | template 148 | constexpr auto state::break_( // . 149 | ) const noexcept 150 | { 151 | return break_(accumulator()); 152 | } 153 | } 154 | 155 | // The last, and most complex part to implement, is the `static_for` 156 | // function, that will deal with iteration and accumulation. 157 | 158 | // The function will take a single parameter, the loop body: 159 | template 160 | auto static_for(TFBody&& body) 161 | { 162 | // Now we'll define a `step` inner function that will deal with 163 | // the recursion. Since it is not possible to write a recursive 164 | // lambda, we need to pass `step` to itself as a parameter, 165 | // called `self`, in order to perform recursion. 166 | 167 | auto step = [body = FWD(body)]( // . 168 | auto self, // `step` itself, used to recurse. 169 | auto state, // Current state. 170 | auto&& x, // Current for-each argument. 171 | auto&&... xs // Rest of the arguments. 172 | ) 173 | { 174 | // We start by computing the next state, by executing `body` 175 | // on the current state and the current `x` argument. 176 | auto next_state = body(state, x); 177 | 178 | // Check if this is the last iteration, by checking if the 179 | // remaining argument pack is empty. 180 | constexpr auto last_iteration = bool_v<(sizeof...(xs) == 0)>; 181 | 182 | // Now we need to check if the next action is a break. 183 | // To make sure we immediately break, without computing one 184 | // additional step, we need to check if the next action of 185 | // the NEXT state will be a break. 186 | 187 | // To do so, we simply check if the type of the next state's 188 | // next action is `action::a_break`: 189 | constexpr auto must_break = bool_v<( // . 190 | std::is_same< // . 191 | decltype(next_state.next_action()), // . 192 | impl::action::a_break // . 193 | >{} // . 194 | )>; 195 | 196 | // It's time to deal with recursion - `static_if` will come 197 | // in handy here. 198 | 199 | // If we must break, or if this is the last iteration, we 200 | // will return the next accumulator value (final result). 201 | 202 | // Otherwise, we call `self`, which is actually `step`, with 203 | // the newly computed step and the rest of the argument pack. 204 | 205 | return static_if(bool_v<(must_break || last_iteration)>) 206 | .then([next_state](auto&&) 207 | { 208 | // Final step. 209 | return next_state.accumulator(); 210 | }) 211 | .else_([next_state, state, &xs...](auto&& xself) 212 | { 213 | // Recursive step. 214 | return xself(xself, next_state, xs...); 215 | })(self); 216 | }; 217 | 218 | // The first step will be binding an initial accumulator value 219 | // to the loop execution. To do so, we simply let `static_for` 220 | // return an unary function that will take the accumulator as a 221 | // parameter: 222 | return [step = std::move(step)](auto accumulator) 223 | { 224 | // After binding the accumulator, we'll return a variadic 225 | // function that will start the loop execution with the passed 226 | // parameters: 227 | return [step, accumulator](auto&&... xs) 228 | { 229 | // We now need to start off the recursion. Since our 230 | // `step` lambda expects at least one argument, we also 231 | // have to explicitly check for an empty `static_for` 232 | // call. 233 | 234 | return static_if(bool_v<(sizeof...(xs) == 0)>) 235 | .then([accumulator](auto&&) 236 | { 237 | // In case no parameters were passed, we'll 238 | // immediately return `accumulator`. 239 | return accumulator; 240 | }) 241 | .else_([accumulator](auto&& xstep, auto&&... ys) 242 | { 243 | // Otherwise, we'll create an initial state: 244 | auto initial_state = impl::make_state( // . 245 | sz_v<0>, // . 246 | accumulator, // . 247 | impl::action::a_continue{} // . 248 | ); 249 | 250 | // Then finally call `step`. 251 | return xstep(xstep, initial_state, FWD(ys)...); 252 | })(step, FWD(xs)...); 253 | }; 254 | }; 255 | } 256 | 257 | // That's it! 258 | // Let's test our implementation. 259 | 260 | int main() 261 | { 262 | auto result = // . 263 | static_for([](auto state, auto&& x) 264 | { 265 | std::cout // . 266 | << "Iteration (" << state.iteration() // . 267 | << ")\nValue (" << x // . 268 | << ")\nAccumulator (" << state.accumulator() // . 269 | << ")\n\n"; 270 | 271 | auto new_acc = sz_v<( // . 272 | decltype(state){}.accumulator() + decltype(x){} // . 273 | )>; 274 | 275 | return state.continue_(new_acc); 276 | })(sz_v<0>)(sz_v<10>, sz_v<20>, sz_v<30>, sz_v<40>); 277 | 278 | std::cout << "Result (" << result << ")\n"; 279 | } -------------------------------------------------------------------------------- /static_control_flow/code/p08.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Vittorio Romeo 2 | // License: AFL 3.0 | https://opensource.org/licenses/AFL-3.0 3 | // http://vittorioromeo.info | vittorio.romeo@outlook.com 4 | 5 | // +-----------------------------------------------+ 6 | // | | 7 | // | Conclusion | 8 | // | (assembly comparisons) | 9 | // | (production-ready solutions) | 10 | // | | 11 | // +-----------------------------------------------+ 12 | 13 | // For our last code segment, let's take a look at the generated 14 | // assembly and at existing production-ready solutions. 15 | 16 | // Test files: 17 | // * `./asm/traditional.cpp` 18 | // * `./asm/staticfor.cpp` 19 | 20 | // "g++ 5.3.0" produces identical assembly from `-O1` onwards. 21 | // "g++ 6.1.1" produces identical assembly from `-O1` onwards. 22 | // "clang++ 3.7.1" produces identical assembly from `-O2` onwards. 23 | // "clang++ 3.8.1" produces identical assembly from `-O2` onwards. 24 | 25 | // Similar results were obtained for `static_if` as well. 26 | // Both constructs are effectively "cost-free abstractions". 27 | 28 | // You can fork and use the implementations shown here, create your 29 | // own from scratch, or use any of the following production-ready 30 | // solutions. 31 | 32 | // (Obviously, if you have access to C++17, use `if constexpr`!) 33 | 34 | // Louis Dionne's "boost::hana", which hopefully needs no 35 | // introduction, has extremely powerful constructs both for 36 | // compile-time iteration and branching. 37 | // Here are some (very basic) examples: 38 | /* 39 | // `hana::eval_if` essentially works like our `static_if`. 40 | template 41 | auto fact(N n) { 42 | return hana::eval_if(n == hana::int_c<0>, 43 | [] { return hana::int_c<1>; }, 44 | [=](auto _) { return n * fact(_(n) - hana::int_c<1>); } 45 | ); 46 | } 47 | 48 | // `hana::for_each` can be used to iterate over an heterogeneous 49 | // compile-time sequence. 50 | std::stringstream ss; 51 | hana::for_each(hana::make_tuple(0, '1', "234", 5.5), [&](auto x){ 52 | ss << x << ' '; 53 | }); 54 | */ 55 | 56 | // Paul Fultz II's "fit" modern function utility library can be 57 | // used to replicate `static_if`'s functionality. Here's an example 58 | // provided by the author himself: 59 | /* 60 | template 61 | void decrement_kindof(T& value) 62 | { 63 | eval(conditional( 64 | if_(std::is_same())([&](auto id){ 65 | id(value).pop_back(); 66 | }), 67 | [&](auto id){ 68 | --id(value); 69 | } 70 | )); 71 | } 72 | */ 73 | 74 | // By using `fit::compress` and `fit::apply` it's also easy to begin 75 | // replicating `static_for`'s functionality. More powerful results 76 | // can be achieved by properly using all the library's features. 77 | /* 78 | compress(apply, for_body)(x, y, z) 79 | // ...is equivalent to: 80 | for_body(x)(y)(z) 81 | */ 82 | 83 | int main() 84 | { 85 | } -------------------------------------------------------------------------------- /static_control_flow/code/test_all_clang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for x in ./*.cpp; 4 | do (./cerc $x); 5 | done -------------------------------------------------------------------------------- /static_control_flow/code/test_all_gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for x in ./*.cpp; 4 | do (./cer $x); 5 | done -------------------------------------------------------------------------------- /static_control_flow/code/verify_sanitizers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear; clear; 3 | 4 | FLAGS='-std=c++14 -D_GLIBCXX_DEBUG -g3 -W -Wall -Wextra -Wpedantic' 5 | 6 | fn() 7 | { 8 | echo "$1 $2" 9 | $1 $FLAGS -O0 -fsanitize=$2 -o "/tmp/$3.x" $4 && "/tmp/$3.x" 10 | $1 $FLAGS -Ofast -fsanitize=$2 -o "/tmp/$3.x" $4 && "/tmp/$3.x" 11 | echo "$1 $2 done" 12 | } 13 | 14 | (fn clang++ undefined x0 $1) & 15 | (fn clang++ address x1 $1) & 16 | (fn clang++ memory x2 $1) & 17 | 18 | (fn g++ undefined x3 $1) & 19 | (fn g++ address x4 $1) & 20 | 21 | wait -------------------------------------------------------------------------------- /static_control_flow/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vittorioromeo/meetingcpp2016/7e81255d69dfbf75fd96f62a1de60a54caad95d0/static_control_flow/slides.pdf -------------------------------------------------------------------------------- /static_control_flow/slides.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vittorioromeo/meetingcpp2016/7e81255d69dfbf75fd96f62a1de60a54caad95d0/static_control_flow/slides.pptx --------------------------------------------------------------------------------