// File: onlyuser[P]Sandbox/test_c/c++14/main2.cpp
// Function: main
int main(int argc, char** argv)
{
    //===============
    // lhs_lvalue_ref
    //===============

    // non-const
    std::cout << "lhs_lvalue_ref(rhs_lvalue_ref())" << std::endl;
    lhs_lvalue_ref(rhs_lvalue_ref());

    std::cout << "lhs_lvalue_ref(rhs_rvalue())" << std::endl;
    std::cout << "\terror: invalid initialization of non-const reference of type ‘Foo&’ from an rvalue of type ‘Foo’" << std::endl;
    //lhs_lvalue_ref(rhs_rvalue());

    std::cout << "lhs_lvalue_ref(rhs_rvalue_ref())" << std::endl;
    std::cout << "\terror: invalid initialization of non-const reference of type ‘Foo&’ from an rvalue of type ‘std::remove_reference<Foo>::type {aka Foo}’" << std::endl;
    //lhs_lvalue_ref(rhs_rvalue_ref());

    // const
    std::cout << "lhs_const_lvalue_ref(rhs_lvalue_ref())" << std::endl;
    lhs_const_lvalue_ref(rhs_lvalue_ref());

    std::cout << "lhs_const_lvalue_ref(rhs_rvalue())" << std::endl;
    lhs_const_lvalue_ref(rhs_rvalue());

    std::cout << "lhs_const_lvalue_ref(rhs_rvalue_ref())" << std::endl;
    lhs_const_lvalue_ref(rhs_rvalue_ref());

    //===========
    // lhs_rvalue
    //===========

    // non-const
    std::cout << "lhs_rvalue(rhs_lvalue_ref())" << std::endl;
    lhs_rvalue(rhs_lvalue_ref());

    std::cout << "lhs_rvalue(rhs_rvalue())" << std::endl;
    lhs_rvalue(rhs_rvalue());

    std::cout << "lhs_rvalue(rhs_rvalue_ref())" << std::endl;
    lhs_rvalue(rhs_rvalue_ref());

    // const
    std::cout << "lhs_const_rvalue(rhs_lvalue_ref())" << std::endl;
    lhs_const_rvalue(rhs_lvalue_ref());

    std::cout << "lhs_const_rvalue(rhs_rvalue())" << std::endl;
    lhs_const_rvalue(rhs_rvalue());

    std::cout << "lhs_const_rvalue(rhs_rvalue_ref())" << std::endl;
    lhs_const_rvalue(rhs_rvalue_ref());

    //===============
    // lhs_rvalue_ref
    //===============

    // non-const
    std::cout << "lhs_rvalue_ref(rhs_lvalue_ref())" << std::endl;
    std::cout << "\terror: cannot bind ‘Foo’ lvalue to ‘Foo&&’" << std::endl;
    //lhs_rvalue_ref(rhs_lvalue_ref());

    std::cout << "lhs_rvalue_ref(rhs_rvalue())" << std::endl;
    lhs_rvalue_ref(rhs_rvalue());

    std::cout << "lhs_rvalue_ref(rhs_rvalue_ref())" << std::endl;
    lhs_rvalue_ref(rhs_rvalue_ref());

    // const
    std::cout << "lhs_const_rvalue_ref(rhs_lvalue_ref())" << std::endl;
    std::cout << "\terror: cannot bind ‘Foo’ lvalue to ‘const Foo&&’" << std::endl;
    //lhs_const_rvalue_ref(rhs_lvalue_ref());

    std::cout << "lhs_const_rvalue_ref(rhs_rvalue())" << std::endl;
    lhs_const_rvalue_ref(rhs_rvalue());

    std::cout << "lhs_const_rvalue_ref(rhs_rvalue_ref())" << std::endl;
    lhs_const_rvalue_ref(rhs_rvalue_ref());

    //=================
    // lhs_unversal_ref
    //=================

    // non-const
    std::cout << "lhs_unversal_ref(rhs_lvalue_ref())" << std::endl;
    lhs_unversal_ref(rhs_lvalue_ref());

    std::cout << "lhs_unversal_ref(rhs_rvalue())" << std::endl;
    lhs_unversal_ref(rhs_rvalue());

    std::cout << "lhs_unversal_ref(rhs_rvalue_ref())" << std::endl;
    lhs_unversal_ref(rhs_rvalue_ref());

    // const
    std::cout << "lhs_const_unversal_ref(rhs_lvalue_ref())" << std::endl;
    std::cout << "\terror: cannot bind ‘Foo’ lvalue to ‘const Foo&&’" << std::endl;
    //lhs_const_unversal_ref(rhs_lvalue_ref());

    std::cout << "lhs_const_unversal_ref(rhs_rvalue())" << std::endl;
    std::cout << "\terror: no matching function for call to ‘forward(const Foo&)" << std::endl;
    //lhs_const_unversal_ref(rhs_rvalue());

    std::cout << "lhs_const_unversal_ref(rhs_rvalue_ref())" << std::endl;
    std::cout << "\terror: no matching function for call to ‘forward(const Foo&)’" << std::endl;
    //lhs_const_unversal_ref(rhs_rvalue_ref());

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x2988(%rip), %rdi      # 0x3fd8
movq %rdi, -0x50(%rbp)
leaq 0xb0a(%rip), %rsi       # 0x2165
callq 0x1060
movq %rax, %rdi
movq 0x295e(%rip), %rsi      # 0x3fc8
movq %rsi, -0x48(%rbp)
callq 0x1070
callq 0x11f0
movq %rax, %rdi
callq 0x1370
movq -0x50(%rbp), %rdi
leaq 0xafb(%rip), %rsi       # 0x2186
callq 0x1060
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
movq -0x50(%rbp), %rdi
leaq 0xafc(%rip), %rsi       # 0x21a3
callq 0x1060
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
movq -0x50(%rbp), %rdi
leaq 0xb4a(%rip), %rsi       # 0x220d
callq 0x1060
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
movq -0x50(%rbp), %rdi
leaq 0xb4f(%rip), %rsi       # 0x222e
callq 0x1060
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
movq -0x50(%rbp), %rdi
leaq 0xbc4(%rip), %rsi       # 0x22bf
callq 0x1060
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
callq 0x11f0
movq %rax, %rdi
callq 0x1430
movq -0x50(%rbp), %rdi
leaq 0xbc2(%rip), %rsi       # 0x22e6
callq 0x1060
movq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
leaq -0x11(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x1280
movq -0x40(%rbp), %rdi
callq 0x1430
jmp 0x174d
leaq -0x11(%rbp), %rdi
callq 0x1e80
movq 0x287b(%rip), %rdi      # 0x3fd8
leaq 0xba5(%rip), %rsi       # 0x2309
callq 0x1060
movq %rax, %rdi
movq 0x2855(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x25(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x1280
movq -0x58(%rbp), %rdi
callq 0x1430
jmp 0x1790
leaq -0x25(%rbp), %rdi
callq 0x1e80
movq 0x2838(%rip), %rdi      # 0x3fd8
leaq 0xb89(%rip), %rsi       # 0x2330
callq 0x1060
movq %rax, %rdi
movq 0x2812(%rip), %rsi      # 0x3fc8
callq 0x1070
callq 0x11f0
movq %rax, %rsi
leaq -0x26(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x1e90
movq -0x60(%rbp), %rdi
callq 0x13b0
jmp 0x17db
leaq -0x26(%rbp), %rdi
callq 0x1e80
movq 0x27ed(%rip), %rdi      # 0x3fd8
leaq 0xb5b(%rip), %rsi       # 0x234d
callq 0x1060
movq %rax, %rdi
movq 0x27c7(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x27(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x1280
movq -0x68(%rbp), %rdi
callq 0x13b0
jmp 0x181e
leaq -0x27(%rbp), %rdi
callq 0x1e80
movq 0x27aa(%rip), %rdi      # 0x3fd8
leaq 0xb31(%rip), %rsi       # 0x2366
callq 0x1060
movq %rax, %rdi
movq 0x2784(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x29(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x1280
movq -0x70(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x1e90
jmp 0x1865
leaq -0x28(%rbp), %rdi
callq 0x13b0
jmp 0x1870
leaq -0x28(%rbp), %rdi
callq 0x1e80
leaq -0x29(%rbp), %rdi
callq 0x1e80
movq 0x274f(%rip), %rdi      # 0x3fd8
leaq 0xaf3(%rip), %rsi       # 0x2383
callq 0x1060
movq %rax, %rdi
movq 0x2729(%rip), %rsi      # 0x3fc8
callq 0x1070
callq 0x11f0
movq %rax, %rsi
leaq -0x2a(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x1e90
movq -0x78(%rbp), %rdi
callq 0x1470
jmp 0x18c4
leaq -0x2a(%rbp), %rdi
callq 0x1e80
movq 0x2704(%rip), %rdi      # 0x3fd8
leaq 0xacb(%rip), %rsi       # 0x23a6
callq 0x1060
movq %rax, %rdi
movq 0x26de(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x2b(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x1280
movq -0x80(%rbp), %rdi
callq 0x1470
jmp 0x1907
leaq -0x2b(%rbp), %rdi
callq 0x1e80
movq 0x26c1(%rip), %rdi      # 0x3fd8
leaq 0xaa7(%rip), %rsi       # 0x23c5
callq 0x1060
movq %rax, %rdi
movq 0x269b(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x2d(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x1280
movq -0x88(%rbp), %rsi
leaq -0x2c(%rbp), %rdi
callq 0x1e90
jmp 0x1954
leaq -0x2c(%rbp), %rdi
callq 0x1470
jmp 0x195f
leaq -0x2c(%rbp), %rdi
callq 0x1e80
leaq -0x2d(%rbp), %rdi
callq 0x1e80
movq 0x2660(%rip), %rdi      # 0x3fd8
movq %rdi, -0xa0(%rbp)
leaq 0xa62(%rip), %rsi       # 0x23e8
callq 0x1060
movq %rax, %rdi
movq 0x2633(%rip), %rsi      # 0x3fc8
movq %rsi, -0x98(%rbp)
callq 0x1070
movq -0xa0(%rbp), %rdi
leaq 0xa5a(%rip), %rsi       # 0x2409
callq 0x1060
movq -0x98(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
movq -0xa0(%rbp), %rdi
leaq 0xa6c(%rip), %rsi       # 0x243d
callq 0x1060
movq -0x98(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
leaq -0x2e(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x1280
movq -0x90(%rbp), %rdi
callq 0x13f0
jmp 0x1a03
leaq -0x2e(%rbp), %rdi
callq 0x1e80
movq 0x25c5(%rip), %rdi      # 0x3fd8
leaq 0xa40(%rip), %rsi       # 0x245a
callq 0x1060
movq %rax, %rdi
movq 0x259f(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x2f(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x1280
movq -0xa8(%rbp), %rdi
callq 0x13f0
jmp 0x1a4c
leaq -0x2f(%rbp), %rdi
callq 0x1e80
movq 0x257c(%rip), %rdi      # 0x3fd8
movq %rdi, -0xc0(%rbp)
leaq 0xa11(%rip), %rsi       # 0x247b
callq 0x1060
movq %rax, %rdi
movq 0x254f(%rip), %rsi      # 0x3fc8
movq %rsi, -0xb8(%rbp)
callq 0x1070
movq -0xc0(%rbp), %rdi
leaq 0xa0f(%rip), %rsi       # 0x24a2
callq 0x1060
movq -0xb8(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
movq -0xc0(%rbp), %rdi
leaq 0xa27(%rip), %rsi       # 0x24dc
callq 0x1060
movq -0xb8(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
leaq -0x30(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x1280
movq -0xb0(%rbp), %rdi
callq 0x14b0
jmp 0x1ae7
leaq -0x30(%rbp), %rdi
callq 0x1e80
movq 0x24e1(%rip), %rdi      # 0x3fd8
leaq 0xa01(%rip), %rsi       # 0x24ff
callq 0x1060
movq %rax, %rdi
movq 0x24bb(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x31(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x1280
movq -0xc8(%rbp), %rdi
callq 0x14b0
jmp 0x1b30
leaq -0x31(%rbp), %rdi
callq 0x1e80
movq 0x2498(%rip), %rdi      # 0x3fd8
movq %rdi, -0xe0(%rbp)
leaq 0x9d8(%rip), %rsi       # 0x2526
callq 0x1060
movq %rax, %rdi
movq 0x246b(%rip), %rsi      # 0x3fc8
movq %rsi, -0xd8(%rbp)
callq 0x1070
callq 0x11f0
movq %rax, %rdi
callq 0x1ea0
movq -0xe0(%rbp), %rdi
leaq 0x9c5(%rip), %rsi       # 0x2549
callq 0x1060
movq -0xd8(%rbp), %rsi
movq %rax, %rdi
callq 0x1070
leaq -0x32(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x1280
movq -0xd0(%rbp), %rdi
callq 0x1ef0
jmp 0x1bb6
leaq -0x32(%rbp), %rdi
callq 0x1e80
movq 0x2412(%rip), %rdi      # 0x3fd8
leaq 0x99b(%rip), %rsi       # 0x2568
callq 0x1060
movq %rax, %rdi
movq 0x23ec(%rip), %rsi      # 0x3fc8
callq 0x1070
leaq -0x33(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x1280
movq -0xe8(%rbp), %rdi
callq 0x1ef0
jmp 0x1bff
leaq -0x33(%rbp), %rdi
callq 0x1e80
movq 0x23c9(%rip), %rdi      # 0x3fd8
leaq 0x975(%rip), %rsi       # 0x258b
callq 0x1060
movq %rax, %rdi
movq 0x23a3(%rip), %rsi      # 0x3fc8
callq 0x1070
movq 0x23a7(%rip), %rdi      # 0x3fd8
leaq 0x86a(%rip), %rsi       # 0x24a2
callq 0x1060
movq %rax, %rdi
movq 0x2381(%rip), %rsi      # 0x3fc8
callq 0x1070
movq 0x2385(%rip), %rdi      # 0x3fd8
leaq 0x95a(%rip), %rsi       # 0x25b4
callq 0x1060
movq %rax, %rdi
movq 0x235f(%rip), %rsi      # 0x3fc8
callq 0x1070
movq 0x2363(%rip), %rdi      # 0x3fd8
leaq 0x95d(%rip), %rsi       # 0x25d9
callq 0x1060
movq %rax, %rdi
movq 0x233d(%rip), %rsi      # 0x3fc8
callq 0x1070
movq 0x2341(%rip), %rdi      # 0x3fd8
leaq 0x97b(%rip), %rsi       # 0x2619
callq 0x1060
movq %rax, %rdi
movq 0x231b(%rip), %rsi      # 0x3fc8
callq 0x1070
movq 0x231f(%rip), %rdi      # 0x3fd8
leaq 0x982(%rip), %rsi       # 0x2642
callq 0x1060
movq %rax, %rdi
movq 0x22f9(%rip), %rsi      # 0x3fc8
callq 0x1070
xorl %eax, %eax
addq $0xf0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x11(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x25(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x26(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x27(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1d6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x1e80
leaq -0x29(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x2b(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1dcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x2c(%rbp), %rdi
callq 0x1e80
leaq -0x2d(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x2e(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x2f(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x32(%rbp), %rdi
callq 0x1e80
jmp 0x1e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x33(%rbp), %rdi
callq 0x1e80
movq -0x20(%rbp), %rdi
callq 0x1090
nop