// File: WojciechMula[P]utf16utf8/benchmarks/benchmark_from_utf8.cpp
// Function: Benchmark::run_from_utf8()
void run_from_utf8() {
        printf("\n");
        printf("Running UTF8 => UTF16 benchmark.\n");
        printf("The speed is normalized by the number of input bytes.\n");
        const size_t repeat = 10000;
        RandomUTF8 gen_1byte (rd, 1, 0, 0, 0);
        RandomUTF8 gen_2bytes(rd, 0, 1, 0, 0);
        RandomUTF8 gen_3bytes(rd, 0, 0, 1, 0);
        RandomUTF8 gen_4bytes(rd, 0, 0, 0, 1);

        RandomUTF8 gen_1_2(rd, 1, 1, 0, 0);
        RandomUTF8 gen_1_2_3(rd, 1, 1, 1, 0);
        RandomUTF8 gen_1_2_3_4(rd, 1, 1, 1, 1);

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

        puts("- Input ASCII characters");
        run_from_utf8(gen_1byte, repeat);

        puts("- Input exactly 2 UTF8 bytes");
        run_from_utf8(gen_2bytes, repeat);

        puts("- Input exactly 3 UTF8 bytes");
        run_from_utf8(gen_3bytes, repeat);

        puts("- Input exactly 4 UTF8 bytes");
        run_from_utf8(gen_3bytes, repeat);

        puts("- Input 1 or 2 UTF8 bytes");
        run_from_utf8(gen_1_2, repeat);

        puts("- Input 1 or 2 or 3 UTF8 bytes");
        run_from_utf8(gen_1_2_3, repeat);

        puts("- Input 1 or 2 or 3 or 4 UTF8 bytes");
        run_from_utf8(gen_1_2_3_4, repeat);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x8ac0, %rsp           # imm = 0x8AC0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x8ab0(%rbp)
leaq 0xc6ea(%rip), %rdi      # 0x194eb
xorl %eax, %eax
movl %eax, -0x8a9c(%rbp)
movb %al, -0x8ab1(%rbp)
callq 0x2050
movb -0x8ab1(%rbp), %al
leaq 0xc50b(%rip), %rdi      # 0x1932c
callq 0x2050
movb -0x8ab1(%rbp), %al
leaq 0xc51b(%rip), %rdi      # 0x1934e
callq 0x2050
movq -0x8ab0(%rbp), %rsi
movl -0x8a9c(%rbp), %r9d
movq $0x2710, -0x10(%rbp)    # imm = 0x2710
addq $0x8, %rsi
movq %rsi, -0x8aa8(%rbp)
leaq -0x13d8(%rbp), %rdi
movl $0x1, %edx
movl %edx, -0x8aa0(%rbp)
movl %r9d, %ecx
movl %r9d, %r8d
callq 0xade0
movq -0x8aa8(%rbp), %rsi
movl -0x8aa0(%rbp), %ecx
movl -0x8a9c(%rbp), %r9d
leaq -0x27a0(%rbp), %rdi
movl %r9d, %edx
movl %r9d, %r8d
callq 0xade0
jmp 0xce9e
movq -0x8ab0(%rbp), %rsi
addq $0x8, %rsi
leaq -0x3b78(%rbp), %rdi
movl $0x1, %r8d
xorl %r9d, %r9d
movl %r9d, %edx
movl %r9d, %ecx
callq 0xade0
jmp 0xcec6
movq -0x8ab0(%rbp), %rsi
addq $0x8, %rsi
leaq -0x4f40(%rbp), %rdi
xorl %r8d, %r8d
movl $0x1, %r9d
movl %r8d, %edx
movl %r8d, %ecx
callq 0xade0
jmp 0xceee
movq -0x8ab0(%rbp), %rsi
addq $0x8, %rsi
leaq -0x6308(%rbp), %rdi
movl $0x1, %ecx
xorl %r9d, %r9d
movl %ecx, %edx
movl %r9d, %r8d
callq 0xade0
jmp 0xcf14
movq -0x8ab0(%rbp), %rsi
addq $0x8, %rsi
leaq -0x76d0(%rbp), %rdi
movl $0x1, %r8d
xorl %r9d, %r9d
movl %r8d, %edx
movl %r8d, %ecx
callq 0xade0
jmp 0xcf3c
movq -0x8ab0(%rbp), %rsi
addq $0x8, %rsi
leaq -0x8a98(%rbp), %rdi
movl $0x1, %r9d
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0xade0
jmp 0xcf64
movq -0x8ab0(%rbp), %rax
movq (%rax), %rsi
leaq 0xc410(%rip), %rdi      # 0x19385
xorl %eax, %eax
callq 0x2050
jmp 0xcf7e
leaq 0xc418(%rip), %rdi      # 0x1939d
callq 0x2280
jmp 0xcf8c
movq -0x8ab0(%rbp), %rdi
leaq -0x13d8(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xd330
jmp 0xcfa6
leaq 0xc409(%rip), %rdi      # 0x193b6
callq 0x2280
jmp 0xcfb4
movq -0x8ab0(%rbp), %rdi
leaq -0x27a0(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xd330
jmp 0xcfce
leaq 0xc3fe(%rip), %rdi      # 0x193d3
callq 0x2280
jmp 0xcfdc
movq -0x8ab0(%rbp), %rdi
leaq -0x3b78(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xd330
jmp 0xcff6
leaq 0xc3f3(%rip), %rdi      # 0x193f0
callq 0x2280
jmp 0xd004
movq -0x8ab0(%rbp), %rdi
leaq -0x3b78(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xd330
jmp 0xd01e
leaq 0xc3e8(%rip), %rdi      # 0x1940d
callq 0x2280
jmp 0xd02c
movq -0x8ab0(%rbp), %rdi
leaq -0x6308(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xd330
jmp 0xd046
leaq 0xc3da(%rip), %rdi      # 0x19427
callq 0x2280
jmp 0xd054
movq -0x8ab0(%rbp), %rdi
leaq -0x76d0(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xd330
jmp 0xd06e
leaq 0xc3d1(%rip), %rdi      # 0x19446
callq 0x2280
jmp 0xd07c
movq -0x8ab0(%rbp), %rdi
leaq -0x8a98(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0xd330
jmp 0xd096
leaq -0x8a98(%rbp), %rdi
callq 0xdf00
leaq -0x76d0(%rbp), %rdi
callq 0xdf00
leaq -0x6308(%rbp), %rdi
callq 0xdf00
leaq -0x4f40(%rbp), %rdi
callq 0xdf00
leaq -0x3b78(%rbp), %rdi
callq 0xdf00
leaq -0x27a0(%rbp), %rdi
callq 0xdf00
leaq -0x13d8(%rbp), %rdi
callq 0xdf00
addq $0x8ac0, %rsp           # imm = 0x8AC0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x27a8(%rbp)
movl %eax, -0x27ac(%rbp)
jmp 0xd1cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x27a8(%rbp)
movl %eax, -0x27ac(%rbp)
jmp 0xd1bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x27a8(%rbp)
movl %eax, -0x27ac(%rbp)
jmp 0xd1b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x27a8(%rbp)
movl %eax, -0x27ac(%rbp)
jmp 0xd1a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x27a8(%rbp)
movl %eax, -0x27ac(%rbp)
jmp 0xd19b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x27a8(%rbp)
movl %eax, -0x27ac(%rbp)
jmp 0xd18f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x27a8(%rbp)
movl %eax, -0x27ac(%rbp)
leaq -0x8a98(%rbp), %rdi
callq 0xdf00
leaq -0x76d0(%rbp), %rdi
callq 0xdf00
leaq -0x6308(%rbp), %rdi
callq 0xdf00
leaq -0x4f40(%rbp), %rdi
callq 0xdf00
leaq -0x3b78(%rbp), %rdi
callq 0xdf00
leaq -0x27a0(%rbp), %rdi
callq 0xdf00
leaq -0x13d8(%rbp), %rdi
callq 0xdf00
movq -0x27a8(%rbp), %rdi
callq 0x22e0
nopw %cs:(%rax,%rax)
nopl (%rax)