// File: /workspace/github_cpp_makefile_star2_O1/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 0x7a61(%rip), %rdi      # 0xc39d
callq 0x2270
leaq 0x7a76(%rip), %rdi      # 0xc3be
callq 0x2270
leaq 0x8(%rbx), %r14
leaq 0x4f88(%rsp), %rdi
movq %r14, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3084
leaq 0x3ba8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3084
leaq 0x27c8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x3084
leaq 0x7748(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x3084
leaq 0x13e8(%rsp), %rdi
movq %r14, %rsi
movl $0x1, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3084
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x3084
leaq 0x6368(%rsp), %rdi
movq %r14, %rsi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x3084
movq (%rbx), %rsi
leaq 0x777d(%rip), %rdi      # 0xc1b2
xorl %eax, %eax
callq 0x2050
leaq 0x7788(%rip), %rdi      # 0xc1cb
callq 0x2270
leaq 0x4f88(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e16
leaq 0x7781(%rip), %rdi      # 0xc1e5
callq 0x2270
leaq 0x3ba8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e16
leaq 0x777e(%rip), %rdi      # 0xc203
callq 0x2270
leaq 0x27c8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e16
leaq 0x777b(%rip), %rdi      # 0xc221
callq 0x2270
leaq 0x13e8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e16
leaq 0x7775(%rip), %rdi      # 0xc23c
callq 0x2270
leaq 0x8(%rsp), %rsi
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
callq 0x4e16
movq 0x7708(%rsp), %rdi
testq %rdi, %rdi
je 0x4afb
movq 0x7718(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x76f0(%rsp), %rdi
testq %rdi, %rdi
je 0x4b18
movq 0x7700(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x13a8(%rsp), %rdi
testq %rdi, %rdi
je 0x4b35
movq 0x13b8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x1390(%rsp), %rdi
testq %rdi, %rdi
je 0x4b52
movq 0x13a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x2788(%rsp), %rdi
testq %rdi, %rdi
je 0x4b6f
movq 0x2798(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x2770(%rsp), %rdi
testq %rdi, %rdi
je 0x4b8c
movq 0x2780(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x8ae8(%rsp), %rdi
testq %rdi, %rdi
je 0x4ba9
movq 0x8af8(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x8ad0(%rsp), %rdi
testq %rdi, %rdi
je 0x4bc6
movq 0x8ae0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x3b68(%rsp), %rdi
testq %rdi, %rdi
je 0x4be3
movq 0x3b78(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x3b50(%rsp), %rdi
testq %rdi, %rdi
je 0x4c00
movq 0x3b60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x4f48(%rsp), %rdi
testq %rdi, %rdi
je 0x4c1d
movq 0x4f58(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x4f30(%rsp), %rdi
testq %rdi, %rdi
je 0x4c3a
movq 0x4f40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x6328(%rsp), %rdi
testq %rdi, %rdi
je 0x4c57
movq 0x6338(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x6310(%rsp), %rdi
testq %rdi, %rdi
je 0x4c74
movq 0x6320(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $0x8b28, %rsp           # imm = 0x8B28
popq %rbx
popq %r14
retq
movq %rax, %rbx
jmp 0x4cad
movq %rax, %rbx
jmp 0x4cb7
movq %rax, %rbx
jmp 0x4cc4
movq %rax, %rbx
jmp 0x4cd1
movq %rax, %rbx
jmp 0x4cde
movq %rax, %rbx
jmp 0x4ceb
movq %rax, %rbx
leaq 0x6368(%rsp), %rdi
callq 0x5780
leaq 0x8(%rsp), %rdi
callq 0x5780
leaq 0x13e8(%rsp), %rdi
callq 0x5780
leaq 0x7748(%rsp), %rdi
callq 0x5780
leaq 0x27c8(%rsp), %rdi
callq 0x5780
leaq 0x3ba8(%rsp), %rdi
callq 0x5780
leaq 0x4f88(%rsp), %rdi
callq 0x5780
movq %rbx, %rdi
callq 0x22b0