#include int main() { int sum = 0; for (int i : std::views::iota(0, 10)) sum += i; return sum; } // -O0 //0000000000401106
: // 401106: 55 push %rbp // 401107: 48 89 e5 mov %rsp,%rbp // 40110a: 48 83 ec 30 sub $0x30,%rsp // 40110e: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp) // 401115: 48 c7 45 e4 00 00 00 movq $0x0,-0x1c(%rbp) // 40111c: 00 // 40111d: c7 45 e8 0a 00 00 00 movl $0xa,-0x18(%rbp) // 401124: 48 8d 45 e4 lea -0x1c(%rbp),%rax // 401128: 48 89 45 f0 mov %rax,-0x10(%rbp) // 40112c: 48 8b 45 f0 mov -0x10(%rbp),%rax // 401130: 48 89 c7 mov %rax,%rdi // 401133: e8 84 00 00 00 call 4011bc ::begin() const> // 401138: 89 45 e0 mov %eax,-0x20(%rbp) // 40113b: 48 8b 45 f0 mov -0x10(%rbp),%rax // 40113f: 48 89 c7 mov %rax,%rdi // 401142: e8 9b 00 00 00 call 4011e2 ::end() const> // 401147: 89 45 dc mov %eax,-0x24(%rbp) // 40114a: eb 21 jmp 40116d // 40114c: 48 8d 45 e0 lea -0x20(%rbp),%rax // 401150: 48 89 c7 mov %rax,%rdi // 401153: e8 54 00 00 00 call 4011ac ::_Iterator::operator*() const> // 401158: 89 45 ec mov %eax,-0x14(%rbp) // 40115b: 8b 45 ec mov -0x14(%rbp),%eax // 40115e: 01 45 fc add %eax,-0x4(%rbp) // 401161: 48 8d 45 e0 lea -0x20(%rbp),%rax // 401165: 48 89 c7 mov %rax,%rdi // 401168: e8 9b 00 00 00 call 401208 ::_Iterator::operator++()> // 40116d: 48 8d 55 dc lea -0x24(%rbp),%rdx // 401171: 48 8d 45 e0 lea -0x20(%rbp),%rax // 401175: 48 89 d6 mov %rdx,%rsi // 401178: 48 89 c7 mov %rax,%rdi // 40117b: e8 0c 00 00 00 call 40118c ::_Iterator const&, std::ranges::iota_view::_Iterator const&)> // 401180: 83 f0 01 xor $0x1,%eax // 401183: 84 c0 test %al,%al // 401185: 75 c5 jne 40114c // 401187: 8b 45 fc mov -0x4(%rbp),%eax // 40118a: c9 leave // 40118b: c3 ret // -O3 //0000000000401020
: // 401020: b8 2d 00 00 00 mov $0x2d,%eax // 401025: c3 ret