// File: /workspace/github_cpp_makefile_star2_O3/WojciechMula[P]utf16utf8/benchmarks/benchmark_from_utf16.cpp
// Function: Benchmark::run_from_utf16()
void run_from_utf16() {
        printf("\n");
        printf("Running UTF16 => UTF8 benchmark.\n");
        printf("The speed is normalized by the number of input bytes.\n");

        const size_t repeat = 10000;
        RandomUTF16 gen_1byte (rd, 1, 0, 0, 0);
        RandomUTF16 gen_2bytes(rd, 0, 1, 0, 0);
        RandomUTF16 gen_3bytes(rd, 0, 0, 1, 0);
        RandomUTF16 gen_4bytes(rd, 0, 0, 0, 1);
        RandomUTF16 gen_1_2(rd, 1, 1, 0, 0);
        RandomUTF16 gen_1_2_3(rd, 1, 1, 1, 0);
        RandomUTF16 anylength (rd, 1, 1, 1, 1);

        printf("Input size: (UTF16) %lu\n", size);

        puts("- Output ASCII characters");
        run_from_utf16(gen_1byte, repeat);

        puts("- Output exactly 2 UTF8 bytes");
        run_from_utf16(gen_2bytes, repeat);

        puts("- Output exactly 3 UTF8 bytes");
        run_from_utf16(gen_3bytes, repeat);

        //puts("- Output exactly 4 UTF8 bytes");
        // Given that we do not optimize this case at
        // all, it is not a relevant benchmark.
        //run(gen_4bytes, repeat);

        puts("- Output 1 or 2 UTF8 bytes");
        run_from_utf16(gen_1_2, repeat);

        puts("- Output 1, 2 or 3 UTF8 bytes");
        run_from_utf16(gen_1_2_3, repeat);

        // Results from this benchmark appear bogus: SSE is too fast!!!
        //puts("- Output 1, 2, 3 or 4 UTF8 bytes");
        //run(anylength, repeat);
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x8b28, %rsp           # imm = 0x8B28
movq %rdi, %rbx
movl $0xa, %edi
callq 0x2230
leaq 0x7bdf(%rip), %rdi      # 0xc53d
callq 0x2270
leaq 0x7bf4(%rip), %rdi      # 0xc55e
callq 0x2270
leaq 0x8(%rbx), %r14
leaq 0x4f88(%rsp), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
movq %r14, %rsi
callq 0x2ff0
leaq 0x3ba8(%rsp), %rdi
movl $0x1, %ecx
movq %r14, %rsi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2ff0
leaq 0x27c8(%rsp), %rdi
movl $0x1, %r8d
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x2ff0
leaq 0x7748(%rsp), %rdi
movl $0x1, %r9d
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2ff0
leaq 0x13e8(%rsp), %rdi
movl $0x1, %edx
movl $0x1, %ecx
movq %r14, %rsi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2ff0
leaq 0x8(%rsp), %rdi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movq %r14, %rsi
xorl %r9d, %r9d
callq 0x2ff0
leaq 0x6368(%rsp), %rdi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
movq %r14, %rsi
callq 0x2ff0
movq (%rbx), %rsi
leaq 0x78fb(%rip), %rdi      # 0xc352
xorl %eax, %eax
callq 0x2050
leaq 0x7906(%rip), %rdi      # 0xc36b
callq 0x2270
leaq 0x4f88(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e3c
leaq 0x78ff(%rip), %rdi      # 0xc385
callq 0x2270
leaq 0x3ba8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e3c
leaq 0x78fc(%rip), %rdi      # 0xc3a3
callq 0x2270
leaq 0x27c8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e3c
leaq 0x78f9(%rip), %rdi      # 0xc3c1
callq 0x2270
leaq 0x13e8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e3c
leaq 0x78f3(%rip), %rdi      # 0xc3dc
callq 0x2270
leaq 0x8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e3c
movq 0x7708(%rsp), %rdi
testq %rdi, %rdi
je 0x4b1d
movq 0x7718(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x76f0(%rsp), %rdi
testq %rdi, %rdi
je 0x4b3a
movq 0x7700(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x13a8(%rsp), %rdi
testq %rdi, %rdi
je 0x4b57
movq 0x13b8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x1390(%rsp), %rdi
testq %rdi, %rdi
je 0x4b74
movq 0x13a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x2788(%rsp), %rdi
testq %rdi, %rdi
je 0x4b91
movq 0x2798(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x2770(%rsp), %rdi
testq %rdi, %rdi
je 0x4bae
movq 0x2780(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x8ae8(%rsp), %rdi
testq %rdi, %rdi
je 0x4bcb
movq 0x8af8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x8ad0(%rsp), %rdi
testq %rdi, %rdi
je 0x4be8
movq 0x8ae0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x3b68(%rsp), %rdi
testq %rdi, %rdi
je 0x4c05
movq 0x3b78(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x3b50(%rsp), %rdi
testq %rdi, %rdi
je 0x4c22
movq 0x3b60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x4f48(%rsp), %rdi
testq %rdi, %rdi
je 0x4c3f
movq 0x4f58(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x4f30(%rsp), %rdi
testq %rdi, %rdi
je 0x4c5c
movq 0x4f40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x6328(%rsp), %rdi
testq %rdi, %rdi
je 0x4c79
movq 0x6338(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x6310(%rsp), %rdi
testq %rdi, %rdi
je 0x4c96
movq 0x6320(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $0x8b28, %rsp           # imm = 0x8B28
popq %rbx
popq %r14
retq
movq %rax, %rbx
jmp 0x4ccf
movq %rax, %rbx
jmp 0x4cd9
movq %rax, %rbx
jmp 0x4ce6
movq %rax, %rbx
jmp 0x4cf3
movq %rax, %rbx
jmp 0x4d00
movq %rax, %rbx
jmp 0x4d0d
leaq 0x6368(%rsp), %rdi
movq %rax, %rbx
callq 0x57a6
leaq 0x8(%rsp), %rdi
callq 0x57a6
leaq 0x13e8(%rsp), %rdi
callq 0x57a6
leaq 0x7748(%rsp), %rdi
callq 0x57a6
leaq 0x27c8(%rsp), %rdi
callq 0x57a6
leaq 0x3ba8(%rsp), %rdi
callq 0x57a6
leaq 0x4f88(%rsp), %rdi
callq 0x57a6
movq %rbx, %rdi
callq 0x22b0