// File: kdungs[P]cpp-prelude/test_prelude.cc
// Function: test_span()
auto test_span() -> void {
  using Prelude::span;
  auto expectL = std::vector<int>{1, 2, 3, 4};
  auto expectR = std::vector<int>{5, 6, 7, 8};
  std::vector<int> resultL, resultR;
  std::tie(resultL, resultR) = span([](int x) { return x < 5; },
                                    std::vector<int>{1, 2, 3, 4, 5, 6, 7, 8});
  assert(resultL == expectL);
  assert(resultR == expectR);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movl $0x1, -0x38(%rbp)
movl $0x2, -0x34(%rbp)
movl $0x3, -0x30(%rbp)
movl $0x4, -0x2c(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x4, -0x20(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0xa900
movq -0x160(%rbp), %rcx
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x18(%rbp), %rdi
callq 0xa920
jmp 0x6661
leaq -0x39(%rbp), %rdi
callq 0xaa00
movl $0x5, -0x88(%rbp)
movl $0x6, -0x84(%rbp)
movl $0x7, -0x80(%rbp)
movl $0x8, -0x7c(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x4, -0x70(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0xa900
movq -0x168(%rbp), %rcx
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0xa920
jmp 0x66cc
leaq -0x89(%rbp), %rdi
callq 0xaa00
leaq -0xa8(%rbp), %rdi
callq 0xaf60
leaq -0xc0(%rbp), %rdi
callq 0xaf60
movups 0x17acd(%rip), %xmm0    # 0x1e1c4
movaps %xmm0, -0x130(%rbp)
movups 0x17aaf(%rip), %xmm0    # 0x1e1b4
movaps %xmm0, -0x140(%rbp)
leaq -0x140(%rbp), %rax
movq %rax, -0x120(%rbp)
movq $0x8, -0x118(%rbp)
leaq -0x141(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0xa900
movq -0x170(%rbp), %rcx
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdx
leaq -0x110(%rbp), %rdi
callq 0xa920
jmp 0x675b
leaq -0xf0(%rbp), %rdi
leaq -0xf1(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x6950
jmp 0x6777
leaq -0x158(%rbp), %rdi
movq %rdi, -0x190(%rbp)
leaq -0xa8(%rbp), %rsi
movq %rsi, -0x180(%rbp)
leaq -0xc0(%rbp), %rdx
callq 0xb7b0
movq -0x190(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
movq %rsi, -0x188(%rbp)
callq 0xb7f0
movq -0x188(%rbp), %rdi
callq 0xb830
leaq -0x110(%rbp), %rdi
callq 0xa9a0
leaq -0x141(%rbp), %rdi
callq 0xaa00
movq -0x180(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xabe0
movb %al, -0x171(%rbp)
jmp 0x67f5
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0x6801
jmp 0x6806
jmp 0x68a1
leaq 0x17f91(%rip), %rdi     # 0x1e79e
leaq 0x17a67(%rip), %rsi     # 0x1e27b
movl $0x109, %edx            # imm = 0x109
leaq 0x17fe4(%rip), %rcx     # 0x1e804
callq 0x2110
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0xaa00
jmp 0x6943
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x89(%rbp), %rdi
callq 0xaa00
jmp 0x693a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x6882
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0xa9a0
leaq -0x141(%rbp), %rdi
callq 0xaa00
jmp 0x6919
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x6919
leaq -0xc0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xabe0
movb %al, -0x191(%rbp)
jmp 0x68b9
movb -0x191(%rbp), %al
testb $0x1, %al
jne 0x68c5
jmp 0x68c7
jmp 0x68e6
leaq 0x17ef7(%rip), %rdi     # 0x1e7c5
leaq 0x179a6(%rip), %rsi     # 0x1e27b
movl $0x10a, %edx            # imm = 0x10A
leaq 0x17f23(%rip), %rcx     # 0x1e804
callq 0x2110
leaq -0xc0(%rbp), %rdi
callq 0xa9a0
leaq -0xa8(%rbp), %rdi
callq 0xa9a0
leaq -0x68(%rbp), %rdi
callq 0xa9a0
leaq -0x18(%rbp), %rdi
callq 0xa9a0
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
leaq -0xc0(%rbp), %rdi
callq 0xa9a0
leaq -0xa8(%rbp), %rdi
callq 0xa9a0
leaq -0x68(%rbp), %rdi
callq 0xa9a0
leaq -0x18(%rbp), %rdi
callq 0xa9a0
movq -0x48(%rbp), %rdi
callq 0x22b0
nopl (%rax)