// File: lemire[P]validateutf8-experiments/benchmarks/benchmark.cpp
// Function: RealDataBenchmark::run()
void run() {
    printf("\n");
    printf("Running UTF8 validation benchmark.\n");
    printf("The speed is normalized by the number of input bytes.\n");
    const size_t repeat = 1000;
    for (std::string filename : filenames) {
      std::ifstream in(filename);
      if (!in) {
        std::cerr << " I cannot load " << filename << std::endl;
        continue;
      }
      std::vector<char> utf8((std::istreambuf_iterator<char>(in)),
                             std::istreambuf_iterator<char>());
      std::cout << "file: " << filename << " (" << utf8.size() / 1000 << "KB)"
                << std::endl;

      run(utf8, repeat);
    }
  }

// Assembly:
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rdi, 0x2f0(%rsp)
movq 0x2f0(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x1992c(%rip), %rdi     # 0x11228f
movb $0x0, %al
callq 0x2030
leaq 0x197c7(%rip), %rdi     # 0x112138
movb $0x0, %al
callq 0x2030
leaq 0x197dd(%rip), %rdi     # 0x11215c
movb $0x0, %al
callq 0x2030
movq 0x50(%rsp), %rax
movq $0x3e8, 0x2e8(%rsp) # imm = 0x3E8
movq %rax, 0x2e0(%rsp)
movq 0x2e0(%rsp), %rdi
callq 0xf9f00
movq %rax, 0x2d8(%rsp)
movq 0x2e0(%rsp), %rdi
callq 0xf9f30
movq %rax, 0x2d0(%rsp)
leaq 0x2d8(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
callq 0xf9f60
testb $0x1, %al
jne 0xf89e7
jmp 0xf8cbf
leaq 0x2d8(%rsp), %rdi
callq 0xf9fa0
movq %rax, %rsi
leaq 0x2b0(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x20b0
movq 0x48(%rsp), %rsi
leaq 0xa8(%rsp), %rdi
movl $0x8, %edx
callq 0x2300
jmp 0xf8a22
movq 0xa8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xa8(%rsp,%rax), %rdi
callq 0x20e0
movb %al, 0x47(%rsp)
jmp 0xf8a41
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0xf8a4e
jmp 0xf8ad6
movq 0x2359b(%rip), %rdi     # 0x11bff0
leaq 0x19737(%rip), %rsi     # 0x112193
callq 0x21e0
movq %rax, 0x38(%rsp)
jmp 0xf8a68
movq 0x38(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x21c0
movq %rax, 0x30(%rsp)
jmp 0xf8a81
movq 0x30(%rsp), %rdi
movq 0x23533(%rip), %rsi     # 0x11bfc0
callq 0x2210
jmp 0xf8a94
movl $0x3, 0x98(%rsp)
jmp 0xf8c0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
jmp 0xf8cb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
jmp 0xf8ca3
leaq 0x70(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xf9fb0
leaq 0x60(%rsp), %rdi
callq 0xfa010
leaq 0x5f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x2350
movq 0x28(%rsp), %r9
movq 0x70(%rsp), %rsi
movl 0x78(%rsp), %edx
movq 0x60(%rsp), %rcx
movl 0x68(%rsp), %r8d
leaq 0x80(%rsp), %rdi
callq 0xfa040
jmp 0xf8b28
leaq 0x5f(%rsp), %rdi
callq 0x2230
movq 0x23497(%rip), %rdi     # 0x11bfd0
leaq 0x19663(%rip), %rsi     # 0x1121a3
callq 0x21e0
movq %rax, 0x20(%rsp)
jmp 0xf8b4c
movq 0x20(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x21c0
movq %rax, 0x18(%rsp)
jmp 0xf8b65
movq 0x18(%rsp), %rdi
leaq 0x19639(%rip), %rsi     # 0x1121aa
callq 0x21e0
movq %rax, 0x10(%rsp)
jmp 0xf8b7d
leaq 0x80(%rsp), %rdi
callq 0xfa0e0
movq 0x10(%rsp), %rdi
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
mulq %rcx
movq %rdx, %rsi
shrq $0x4, %rsi
callq 0x2060
movq %rax, 0x8(%rsp)
jmp 0xf8bb3
movq 0x8(%rsp), %rdi
leaq 0x195ee(%rip), %rsi     # 0x1121ad
callq 0x21e0
movq %rax, (%rsp)
jmp 0xf8bca
movq (%rsp), %rdi
movq 0x233eb(%rip), %rsi     # 0x11bfc0
callq 0x2210
jmp 0xf8bdc
movq 0x50(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0xfa100
jmp 0xf8bf5
leaq 0x80(%rsp), %rdi
callq 0xffbe0
movl $0x0, 0x98(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x2070
movl 0x98(%rsp), %eax
testl %eax, %eax
jne 0xf8c32
jmp 0xf8c27
movl $0x0, 0x98(%rsp)
leaq 0x2b0(%rsp), %rdi
callq 0x2130
movl 0x98(%rsp), %eax
testl %eax, %eax
je 0xf8c4e
jmp 0xf8c4c
jmp 0xf8c50
jmp 0xf8c50
leaq 0x2d8(%rsp), %rdi
callq 0xffc40
jmp 0xf89c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
leaq 0x5f(%rsp), %rdi
callq 0x2230
jmp 0xf8ca3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
leaq 0x80(%rsp), %rdi
callq 0xffbe0
leaq 0xa8(%rsp), %rdi
callq 0x2070
leaq 0x2b0(%rsp), %rdi
callq 0x2130
jmp 0xf8cc7
addq $0x2f8, %rsp            # imm = 0x2F8
retq
movq 0xa0(%rsp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)
nop