#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  unsigned i;
  unsigned slen;
  char inbuf[256];
  unsigned thischar;
  char *infile = "", *outfile = "";
  FILE *infp, *outfp;
  FILE *coveragefp;
  int cstart, cend;
  char coverstring[256];
  int nglyphs;
  int nextrange();
  if ((coveragefp = fopen("coverage.dat", "r")) == NULL) {
    fprintf(stderr, "\nError: data file \"coverage.dat\" not found.\n\n");
    exit(0);
  }
  if (argc > 1) {
    for (i = 1; i < argc; i++) {
      if (argv[i][0] == '-') {
        switch (argv[i][1]) {
        case 'i':
          infile = &argv[i][2];
          break;
        case 'o':
          outfile = &argv[i][2];
          break;
        default:
          fprintf(stderr, "\nSyntax:\n\n");
          fprintf(stderr, "   %s -p<Unicode_Page> ", argv[0]);
          fprintf(stderr, "-i<Input_File> -o<Output_File> -w\n\n");
          fprintf(stderr, "\nExample:\n\n");
          exit(1);
        }
      }
    }
  }
  if (strlen(infile) > 0) {
    if ((infp = fopen(infile, "r")) == NULL) {
      fprintf(stderr, "Error: can't open %s for input.\n", infile);
      exit(1);
    }
  } else {
    infp = stdin;
  }
  if (strlen(outfile) > 0) {
    if ((outfp = fopen(outfile, "w")) == NULL) {
      fprintf(stderr, "Error: can't open %s for output.\n", outfile);
      exit(1);
    }
  } else {
    outfp = stdout;
  }
  slen = nextrange(coveragefp, &cstart, &cend, coverstring);
  nglyphs = 0;
  fprintf(outfp, "Covered      Range       Script\n");
  fprintf(outfp, "-------      -----       ------\n\n");
  while (slen != 0 && fgets(inbuf, 256 - 1, infp) != NULL) {
    sscanf(inbuf, "%x", &thischar);
    while (cend < thischar && slen != 0) {
      fprintf(outfp, " %5.1f%%  U+%04X..U+%04X  %s\n",
              100.0 * nglyphs / (1 + cend - cstart), cstart, cend, coverstring);
      slen = nextrange(coveragefp, &cstart, &cend, coverstring);
      nglyphs = 0;
      if (cstart <= 0xFDD0 && cend >= 0xFDEF && nglyphs == 0)
        nglyphs += 32;
      else if (cstart <= 0xFFFE && cend >= 0xFFFF && nglyphs == 0)
        nglyphs += 2;
    }
    if (thischar < 0xFDD0 || (thischar > 0xFDEF && thischar < 0xFFFE))
      nglyphs++;
  }
  fprintf(outfp, " %5.1f%%  U+%04X..U+%04X  %s\n",
          100.0 * nglyphs / (1 + cend - cstart), cstart, cend, coverstring);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xf8f(%rip),%rax
mov    %rax,-0x130(%rbp)
lea    0xf81(%rip),%rax
mov    %rax,-0x138(%rbp)
lea    0xe5c(%rip),%rdi
lea    0xe62(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x150(%rbp)
cmp    $0x0,%rax
jne    11e8 <main+0x78>
mov    0x2e08(%rip),%rax
movslq (%rax),%rdi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1317 <main+0x1a7>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1312 <main+0x1a2>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12ff <main+0x18f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x268(%rbp)
sub    $0x69,%eax
je     1253 <main+0xe3>
jmp    123f <main+0xcf>
mov    -0x268(%rbp),%eax
sub    $0x6f,%eax
je     126e <main+0xfe>
jmp    1289 <main+0x119>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
add    $0x2,%rax
mov    %rax,-0x130(%rbp)
jmp    12fa <main+0x18a>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
add    $0x2,%rax
mov    %rax,-0x138(%rbp)
jmp    12fa <main+0x18a>
mov    0x2d48(%rip),%rax
movslq (%rax),%rdi
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d30(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d11(%rip),%rax
movslq (%rax),%rdi
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2cf9(%rip),%rax
movslq (%rax),%rdi
lea    0xda3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    12ff <main+0x18f>
jmp    1304 <main+0x194>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f9 <main+0x89>
jmp    1317 <main+0x1a7>
mov    -0x130(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    137f <main+0x20f>
mov    -0x130(%rbp),%rdi
lea    0xcda(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x140(%rbp)
cmp    $0x0,%rax
jne    137a <main+0x20a>
mov    0x2c80(%rip),%rax
movslq (%rax),%rdi
mov    -0x130(%rbp),%rdx
lea    0xd2f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1390 <main+0x220>
mov    0x2c62(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x140(%rbp)
mov    -0x138(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    13f8 <main+0x288>
mov    -0x138(%rbp),%rdi
lea    0xd05(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x148(%rbp)
cmp    $0x0,%rax
jne    13f3 <main+0x283>
mov    0x2c07(%rip),%rax
movslq (%rax),%rdi
mov    -0x138(%rbp),%rdx
lea    0xcd9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1409 <main+0x299>
mov    0x2bd1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x148(%rbp)
mov    -0x150(%rbp),%rdi
lea    -0x260(%rbp),%rcx
lea    -0x154(%rbp),%rsi
lea    -0x158(%rbp),%rdx
mov    $0x0,%al
call   1050 <nextrange@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x264(%rbp)
mov    -0x148(%rbp),%rdi
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x148(%rbp),%rdi
lea    0xca2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x269(%rbp)
je     149a <main+0x32a>
lea    -0x120(%rbp),%rdi
mov    -0x140(%rbp),%rdx
mov    $0xff,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x269(%rbp)
mov    -0x269(%rbp),%al
test   $0x1,%al
jne    14ad <main+0x33d>
jmp    164f <main+0x4df>
lea    -0x120(%rbp),%rdi
lea    0xc65(%rip),%rsi
lea    -0x124(%rbp),%rdx
call   1070 <sscanf@plt>
mov    -0x158(%rbp),%ecx
xor    %eax,%eax
cmp    -0x124(%rbp),%ecx
mov    %al,-0x26a(%rbp)
jae    14ee <main+0x37e>
cmpl   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x26a(%rbp)
mov    -0x26a(%rbp),%al
test   $0x1,%al
jne    1501 <main+0x391>
jmp    160b <main+0x49b>
mov    -0x148(%rbp),%rdi
cvtsi2sdl -0x264(%rbp),%xmm1
ff
movsd  0xae8(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x158(%rbp),%eax
add    $0x1,%eax
sub    -0x154(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x154(%rbp),%edx
mov    -0x158(%rbp),%ecx
lea    -0x260(%rbp),%r8
lea    0xbd6(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    -0x150(%rbp),%rdi
lea    -0x260(%rbp),%rcx
lea    -0x154(%rbp),%rsi
lea    -0x158(%rbp),%rdx
mov    $0x0,%al
call   1050 <nextrange@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x264(%rbp)
cmpl   $0xfdd0,-0x154(%rbp)
jg     15c5 <main+0x455>
cmpl   $0xfdef,-0x158(%rbp)
jl     15c5 <main+0x455>
cmpl   $0x0,-0x264(%rbp)
jne    15c5 <main+0x455>
mov    -0x264(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x264(%rbp)
jmp    1606 <main+0x496>
cmpl   $0xfffe,-0x154(%rbp)
jg     1601 <main+0x491>
cmpl   $0xffff,-0x158(%rbp)
jl     1601 <main+0x491>
cmpl   $0x0,-0x264(%rbp)
jne    1601 <main+0x491>
mov    -0x264(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x264(%rbp)
jmp    1606 <main+0x496>
jmp    14c7 <main+0x357>
cmpl   $0xfdd0,-0x124(%rbp)
jb     163b <main+0x4cb>
cmpl   $0xfdef,-0x124(%rbp)
jbe    164a <main+0x4da>
cmpl   $0xfffe,-0x124(%rbp)
jae    164a <main+0x4da>
mov    -0x264(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x264(%rbp)
jmp    1463 <main+0x2f3>
mov    -0x148(%rbp),%rdi
cvtsi2sdl -0x264(%rbp),%xmm1
ff
movsd  0x99a(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x158(%rbp),%eax
add    $0x1,%eax
sub    -0x154(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x154(%rbp),%edx
mov    -0x158(%rbp),%ecx
lea    -0x260(%rbp),%r8
lea    0xa88(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe6b(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
jne    11d5 <main+0x55>
mov    0x2e23(%rip),%rax
movslq (%rax),%rcx
lea    0xe58(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
call   10a0 <fwrite@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    %rax,%r15
cmp    $0x2,%ebp
jl     1224 <main+0xa4>
mov    %ebp,%eax
lea    0xf39(%rip),%r14
mov    $0x1,%ecx
mov    %r14,%rbp
jmp    1200 <main+0x80>
add    $0x2,%rdx
mov    %rdx,%r14
add    $0x1,%rcx
cmp    %rcx,%rax
je     122e <main+0xae>
mov    (%rbx,%rcx,8),%rdx
cmpb   $0x2d,(%rdx)
jne    11f7 <main+0x77>
movsbl 0x1(%rdx),%esi
cmp    $0x6f,%esi
je     11f0 <main+0x70>
cmp    $0x69,%esi
jne    1497 <main+0x317>
add    $0x2,%rdx
mov    %rdx,%rbp
jmp    11f7 <main+0x77>
lea    0xef4(%rip),%rbp
mov    %rbp,%r14
mov    %rbp,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    126a <main+0xea>
lea    0xdd3(%rip),%rsi
mov    %rbp,%rdi
call   1080 <fopen@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
jne    1279 <main+0xf9>
mov    0x2d7d(%rip),%rax
movslq (%rax),%rdi
lea    0xe33(%rip),%rsi
mov    %rbp,%rdx
jmp    12b1 <main+0x131>
mov    0x2d77(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
mov    %r14,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    12c2 <main+0x142>
lea    0xe2c(%rip),%rsi
mov    %r14,%rdi
call   1080 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    12cc <main+0x14c>
mov    0x2d34(%rip),%rax
movslq (%rax),%rdi
lea    0xe0d(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2d07(%rip),%rax
mov    (%rax),%r13
xor    %r14d,%r14d
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x20(%rsp),%rcx
mov    %r15,%r12
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <nextrange@plt>
mov    %eax,%r15d
lea    0xde8(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10a0 <fwrite@plt>
lea    0xdf0(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10a0 <fwrite@plt>
test   %r15d,%r15d
jne    136c <main+0x1ec>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  0xccb(%rip),%xmm0
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%edx
mov    %ecx,%eax
sub    %edx,%eax
add    $0x1,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
lea    0xdcd(%rip),%rsi
lea    0x20(%rsp),%r8
mov    %r13,%rdi
mov    $0x1,%al
call   1060 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0x120(%rsp),%rbx
lea    0x20(%rsp),%rbp
xor    %r14d,%r14d
jmp    13ae <main+0x22e>
xchg   %ax,%ax
cmp    $0xfdd0,%eax
setb   %cl
add    $0xffff0210,%eax
cmp    $0x20e,%eax
setb   %al
or     %cl,%al
movzbl %al,%eax
add    %eax,%r14d
test   %r15d,%r15d
lea    0x120(%rsp),%rbx
je     1325 <main+0x1a5>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    0x18(%rsp),%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1325 <main+0x1a5>
mov    %rbx,%rdi
lea    0xd4d(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1070 <sscanf@plt>
mov    0xc(%rsp),%ecx
mov    0x14(%rsp),%eax
cmp    %eax,%ecx
jae    1380 <main+0x200>
mov    0x10(%rsp),%edx
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  0xc00(%rip),%xmm0
mov    %ecx,%eax
sub    %edx,%eax
add    $0x1,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    %r13,%rdi
lea    0xd07(%rip),%rsi
mov    %rbp,%r8
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <nextrange@plt>
mov    %eax,%r15d
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
cmp    $0xffff,%edx
setl   %al
cmp    $0xffff,%ecx
setge  %bl
and    %al,%bl
movzbl %bl,%eax
add    %eax,%eax
cmp    $0xfdef,%ecx
mov    %eax,%r14d
mov    $0x20,%esi
cmovge %esi,%r14d
cmp    $0xfdd1,%edx
cmovge %eax,%r14d
mov    0x14(%rsp),%eax
cmp    %eax,%ecx
jae    1380 <main+0x200>
test   %r15d,%r15d
jne    13f0 <main+0x270>
jmp    1380 <main+0x200>
mov    0x2b3a(%rip),%rbp
movslq 0x0(%rbp),%rcx
lea    0xb9c(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
call   10a0 <fwrite@plt>
movslq 0x0(%rbp),%rdi
mov    (%rbx),%rdx
lea    0xb8a(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movslq 0x0(%rbp),%rcx
lea    0xb90(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
call   10a0 <fwrite@plt>
movslq 0x0(%rbp),%rcx
lea    0xb9a(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [13 x i8] c"coverage.dat\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [46 x i8] c"\0AError: data file \22coverage.dat\22 not found.\0A\0A\00"
@.str.4 = [11 x i8] c"\0ASyntax:\0A\0A\00"
@.str.5 = [24 x i8] c" %s -p<Unicode_Page> \00"
@.str.6 = [36 x i8] c"-i<Input_File> -o<Output_File> -w\0A\0A\00"
@.str.7 = [12 x i8] c"\0AExample:\0A\0A\00"
@.str.8 = [33 x i8] c"Error: can't open %s for input.\0A\00"
@stdin = global i32* null
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [34 x i8] c"Error: can't open %s for output.\0A\00"
@stdout = global i32* null
@.str.11 = [33 x i8] c"Covered Range Script\0A\00"
@.str.12 = [34 x i8] c"------- ----- ------\0A\0A\00"
@.str.13 = [3 x i8] c"%x\00"
@.str.14 = [30 x i8] c" %5.1f%% U+%04X..U+%04X %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [256 x i8]
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca [256 x i8]
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %11
%19 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %19, i32** %14
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %27
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %2
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 1
br i1 %29, label %30, label %95
30: ; preds = %27
store i32 1, i32* %6
br label %31
31: ; preds = %91, %30
%32 = load i32, i32* %6
%33 = load i32, i32* %4
%34 = icmp ult i32 %32, %33
br i1 %34, label %35, label %94
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = load i32, i32* %6
%38 = zext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 45
br i1 %44, label %45, label %90
45: ; preds = %35
%46 = load i8**, i8*** %5
%47 = load i32, i32* %6
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
switch i32 %53, label %68 [
i32 105, label %54
i32 111, label %61
]
54: ; preds = %45
%55 = load i8**, i8*** %5
%56 = load i32, i32* %6
%57 = zext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = getelementptr inbounds i8, i8* %59, i64 2
store i8* %60, i8** %10
br label %89
61: ; preds = %45
%62 = load i8**, i8*** %5
%63 = load i32, i32* %6
%64 = zext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %62, i64 %64
%66 = load i8*, i8** %65
%67 = getelementptr inbounds i8, i8* %66, i64 2
store i8* %67, i8** %11
br label %89
68: ; preds = %45
%69 = load i32, i32* @stderr
%70 = sext i32 %69 to i64
%71 = inttoptr i64 %70 to i32*
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%73 = load i32, i32* @stderr
%74 = sext i32 %73 to i64
%75 = inttoptr i64 %74 to i32*
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 0
%78 = load i8*, i8** %77
%79 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %78)
%80 = load i32, i32* @stderr
%81 = sext i32 %80 to i64
%82 = inttoptr i64 %81 to i32*
%83 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%84 = load i32, i32* @stderr
%85 = sext i32 %84 to i64
%86 = inttoptr i64 %85 to i32*
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%88 = call i32 @exit(i32 1)
unreachable
89: ; preds = %61, %54
br label %90
90: ; preds = %89, %35
br label %91
91: ; preds = %90
%92 = load i32, i32* %6
%93 = add i32 %92, 1
store i32 %93, i32* %6
br label %31
94: ; preds = %31
br label %95
95: ; preds = %94, %27
%96 = load i8*, i8** %10
%97 = call i64 @strlen(i8* %96)
%98 = icmp sgt i64 %97, 0
br i1 %98, label %99, label %111
99: ; preds = %95
%100 = load i8*, i8** %10
%101 = call i32* @fopen(i8* %100, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %101, i32** %12
%102 = icmp eq i32* %101, null
br i1 %102, label %103, label %110
103: ; preds = %99
%104 = load i32, i32* @stderr
%105 = sext i32 %104 to i64
%106 = inttoptr i64 %105 to i32*
%107 = load i8*, i8** %10
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %106, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i8* %107)
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %99
br label %113
111: ; preds = %95
%112 = load i32*, i32** @stdin
store i32* %112, i32** %12
br label %113
113: ; preds = %111, %110
%114 = load i8*, i8** %11
%115 = call i64 @strlen(i8* %114)
%116 = icmp sgt i64 %115, 0
br i1 %116, label %117, label %129
117: ; preds = %113
%118 = load i8*, i8** %11
%119 = call i32* @fopen(i8* %118, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %119, i32** %13
%120 = icmp eq i32* %119, null
br i1 %120, label %121, label %128
121: ; preds = %117
%122 = load i32, i32* @stderr
%123 = sext i32 %122 to i64
%124 = inttoptr i64 %123 to i32*
%125 = load i8*, i8** %11
%126 = call i32 (i32*, i8*, ...) @fprintf(i32* %124, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i8* %125)
%127 = call i32 @exit(i32 1)
unreachable
128: ; preds = %117
br label %131
129: ; preds = %113
%130 = load i32*, i32** @stdout
store i32* %130, i32** %13
br label %131
131: ; preds = %129, %128
%132 = load i32*, i32** %14
%133 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%134 = call i32 (i32*, i32*, i32*, i8*, ...) bitcast (i32 (...)* @nextrange to i32 (i32*, i32*, i32*, i8*, ...)*)(i32* %132, i32* %15, i32* %16, i8* %133)
store i32 %134, i32* %7
store i32 0, i32* %18
%135 = load i32*, i32** %13
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %135, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
%137 = load i32*, i32** %13
%138 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0))
br label %139
139: ; preds = %216, %131
%140 = load i32, i32* %7
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %147
142: ; preds = %139
%143 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%144 = load i32*, i32** %12
%145 = call i32* @fgets(i8* %143, i32 255, i32* %144)
%146 = icmp ne i32* %145, null
br label %147
147: ; preds = %142, %139
%148 = phi i1 [ false, %139 ], [ %146, %142 ]
br i1 %148, label %149, label %217
149: ; preds = %147
%150 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%151 = call i32 @sscanf(i8* %150, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %9)
br label %152
152: ; preds = %203, %149
%153 = load i32, i32* %16
%154 = load i32, i32* %9
%155 = icmp ult i32 %153, %154
br i1 %155, label %156, label %159
156: ; preds = %152
%157 = load i32, i32* %7
%158 = icmp ne i32 %157, 0
br label %159
159: ; preds = %156, %152
%160 = phi i1 [ false, %152 ], [ %158, %156 ]
br i1 %160, label %161, label %204
161: ; preds = %159
%162 = load i32*, i32** %13
%163 = load i32, i32* %18
%164 = sitofp i32 %163 to double
%165 = fmul double 1.000000e+02, %164
%166 = load i32, i32* %16
%167 = add nsw i32 1, %166
%168 = load i32, i32* %15
%169 = sub nsw i32 %167, %168
%170 = sitofp i32 %169 to double
%171 = fdiv double %165, %170
%172 = load i32, i32* %15
%173 = load i32, i32* %16
%174 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%175 = call i32 (i32*, i8*, ...) @fprintf(i32* %162, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), double %171, i32 %172, i32 %173, i8* %174)
%176 = load i32*, i32** %14
%177 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%178 = call i32 (i32*, i32*, i32*, i8*, ...) bitcast (i32 (...)* @nextrange to i32 (i32*, i32*, i32*, i8*, ...)*)(i32* %176, i32* %15, i32* %16, i8* %177)
store i32 %178, i32* %7
store i32 0, i32* %18
%179 = load i32, i32* %15
%180 = icmp sle i32 %179, 64976
br i1 %180, label %181, label %190
181: ; preds = %161
%182 = load i32, i32* %16
%183 = icmp sge i32 %182, 65007
br i1 %183, label %184, label %190
184: ; preds = %181
%185 = load i32, i32* %18
%186 = icmp eq i32 %185, 0
br i1 %186, label %187, label %190
187: ; preds = %184
%188 = load i32, i32* %18
%189 = add nsw i32 %188, 32
store i32 %189, i32* %18
br label %203
190: ; preds = %184, %181, %161
%191 = load i32, i32* %15
%192 = icmp sle i32 %191, 65534
br i1 %192, label %193, label %202
193: ; preds = %190
%194 = load i32, i32* %16
%195 = icmp sge i32 %194, 65535
br i1 %195, label %196, label %202
196: ; preds = %193
%197 = load i32, i32* %18
%198 = icmp eq i32 %197, 0
br i1 %198, label %199, label %202
199: ; preds = %196
%200 = load i32, i32* %18
%201 = add nsw i32 %200, 2
store i32 %201, i32* %18
br label %202
202: ; preds = %199, %196, %193, %190
br label %203
203: ; preds = %202, %187
br label %152
204: ; preds = %159
%205 = load i32, i32* %9
%206 = icmp ult i32 %205, 64976
br i1 %206, label %213, label %207
207: ; preds = %204
%208 = load i32, i32* %9
%209 = icmp ugt i32 %208, 65007
br i1 %209, label %210, label %216
210: ; preds = %207
%211 = load i32, i32* %9
%212 = icmp ult i32 %211, 65534
br i1 %212, label %213, label %216
213: ; preds = %210, %204
%214 = load i32, i32* %18
%215 = add nsw i32 %214, 1
store i32 %215, i32* %18
br label %216
216: ; preds = %213, %210, %207
br label %139
217: ; preds = %147
%218 = load i32*, i32** %13
%219 = load i32, i32* %18
%220 = sitofp i32 %219 to double
%221 = fmul double 1.000000e+02, %220
%222 = load i32, i32* %16
%223 = add nsw i32 1, %222
%224 = load i32, i32* %15
%225 = sub nsw i32 %223, %224
%226 = sitofp i32 %225 to double
%227 = fdiv double %221, %226
%228 = load i32, i32* %15
%229 = load i32, i32* %16
%230 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%231 = call i32 (i32*, i8*, ...) @fprintf(i32* %218, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), double %227, i32 %228, i32 %229, i8* %230)
%232 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [13 x i8] c"coverage.dat\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [46 x i8] c"\0AError: data file \22coverage.dat\22 not found.\0A\0A\00"
@.str.4 = [11 x i8] c"\0ASyntax:\0A\0A\00"
@.str.5 = [24 x i8] c" %s -p<Unicode_Page> \00"
@.str.6 = [36 x i8] c"-i<Input_File> -o<Output_File> -w\0A\0A\00"
@.str.7 = [12 x i8] c"\0AExample:\0A\0A\00"
@.str.8 = [33 x i8] c"Error: can't open %s for input.\0A\00"
@stdin = global i32* null
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [34 x i8] c"Error: can't open %s for output.\0A\00"
@stdout = global i32* null
@.str.11 = [33 x i8] c"Covered Range Script\0A\00"
@.str.12 = [34 x i8] c"------- ----- ------\0A\0A\00"
@.str.13 = [3 x i8] c"%x\00"
@.str.14 = [30 x i8] c" %5.1f%% U+%04X..U+%04X %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%13 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i64 45, i64 1, i32* %18)
%20 = tail call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = icmp sgt i32 %0, 1
br i1 %22, label %23, label %65
23: ; preds = %21
%24 = zext i32 %0 to i64
br label %25
25: ; preds = %23, %60
%26 = phi i64 [ 1, %23 ], [ %63, %60 ]
%27 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %23 ], [ %62, %60 ]
%28 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %23 ], [ %61, %60 ]
%29 = getelementptr inbounds i8*, i8** %1, i64 %26
%30 = load i8*, i8** %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 45
br i1 %32, label %33, label %60
33: ; preds = %25
%34 = getelementptr inbounds i8, i8* %30, i64 1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
switch i32 %36, label %41 [
i32 105, label %37
i32 111, label %39
]
37: ; preds = %33
%38 = getelementptr inbounds i8, i8* %30, i64 2
br label %60
39: ; preds = %33
%40 = getelementptr inbounds i8, i8* %30, i64 2
br label %60
41: ; preds = %33
%42 = load i32, i32* @stderr
%43 = sext i32 %42 to i64
%44 = inttoptr i64 %43 to i32*
%45 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i64 10, i64 1, i32* %44)
%46 = load i32, i32* @stderr
%47 = sext i32 %46 to i64
%48 = inttoptr i64 %47 to i32*
%49 = load i8*, i8** %1
%50 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @stderr
%52 = sext i32 %51 to i64
%53 = inttoptr i64 %52 to i32*
%54 = tail call i64 @fwrite(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i64 35, i64 1, i32* %53)
%55 = load i32, i32* @stderr
%56 = sext i32 %55 to i64
%57 = inttoptr i64 %56 to i32*
%58 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i64 11, i64 1, i32* %57)
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %25, %39, %37
%61 = phi i8* [ %28, %39 ], [ %38, %37 ], [ %28, %25 ]
%62 = phi i8* [ %40, %39 ], [ %27, %37 ], [ %27, %25 ]
%63 = add nuw nsw i64 %26, 1
%64 = icmp eq i64 %63, %24
br i1 %64, label %65, label %25
65: ; preds = %60, %21
%66 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %21 ], [ %61, %60 ]
%67 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %21 ], [ %62, %60 ]
%68 = tail call i64 @strlen(i8* dereferenceable(1) %66)
%69 = icmp sgt i64 %68, 0
br i1 %69, label %70, label %79
70: ; preds = %65
%71 = tail call i32* @fopen(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %81
73: ; preds = %70
%74 = load i32, i32* @stderr
%75 = sext i32 %74 to i64
%76 = inttoptr i64 %75 to i32*
%77 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %76, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i8* %66)
%78 = tail call i32 @exit(i32 1)
unreachable
79: ; preds = %65
%80 = load i32*, i32** @stdin
br label %81
81: ; preds = %70, %79
%82 = phi i32* [ %71, %70 ], [ %80, %79 ]
%83 = tail call i64 @strlen(i8* dereferenceable(1) %67)
%84 = icmp sgt i64 %83, 0
br i1 %84, label %85, label %94
85: ; preds = %81
%86 = tail call i32* @fopen(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%87 = icmp eq i32* %86, null
br i1 %87, label %88, label %96
88: ; preds = %85
%89 = load i32, i32* @stderr
%90 = sext i32 %89 to i64
%91 = inttoptr i64 %90 to i32*
%92 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %91, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i8* %67)
%93 = tail call i32 @exit(i32 1)
unreachable
94: ; preds = %81
%95 = load i32*, i32** @stdout
br label %96
96: ; preds = %85, %94
%97 = phi i32* [ %86, %85 ], [ %95, %94 ]
%98 = call i32 (i32*, i32*, i32*, i8*, ...) bitcast (i32 (...)* @nextrange to i32 (i32*, i32*, i32*, i8*, ...)*)(i32* %13, i32* %5, i32* %6, i8* %12)
%99 = call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), i64 32, i64 1, i32* %97)
%100 = call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i64 33, i64 1, i32* %97)
%101 = icmp eq i32 %98, 0
br i1 %101, label %151, label %102
102: ; preds = %96, %140
%103 = phi i32 [ %149, %140 ], [ 0, %96 ]
%104 = phi i32 [ %141, %140 ], [ %98, %96 ]
%105 = call i32* @fgets(i8* %8, i32 255, i32* %82)
%106 = icmp eq i32* %105, null
br i1 %106, label %151, label %107
107: ; preds = %102
%108 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %4)
%109 = load i32, i32* %6
%110 = load i32, i32* %4
%111 = icmp ult i32 %109, %110
br i1 %111, label %112, label %140
112: ; preds = %107
%113 = load i32, i32* %5
br label %114
114: ; preds = %112, %114
%115 = phi i32 [ %126, %114 ], [ %113, %112 ]
%116 = phi i32 [ %128, %114 ], [ %109, %112 ]
%117 = phi i32 [ %135, %114 ], [ %103, %112 ]
%118 = sitofp i32 %117 to double
%119 = fmul double %118, 1.000000e+02
%120 = add nuw nsw i32 %116, 1
%121 = sub i32 %120, %115
%122 = sitofp i32 %121 to double
%123 = fdiv double %119, %122
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), double %123, i32 %115, i32 %116, i8* %12)
%125 = call i32 (i32*, i32*, i32*, i8*, ...) bitcast (i32 (...)* @nextrange to i32 (i32*, i32*, i32*, i8*, ...)*)(i32* %13, i32* %5, i32* %6, i8* %12)
%126 = load i32, i32* %5
%127 = icmp slt i32 %126, 64977
%128 = load i32, i32* %6
%129 = icmp sgt i32 %128, 65006
%130 = select i1 %127, i1 %129, i1 false
%131 = icmp slt i32 %126, 65535
%132 = icmp sgt i32 %128, 65534
%133 = select i1 %131, i1 %132, i1 false
%134 = select i1 %133, i32 2, i32 0
%135 = select i1 %130, i32 32, i32 %134
%136 = load i32, i32* %4
%137 = icmp ult i32 %128, %136
%138 = icmp ne i32 %125, 0
%139 = select i1 %137, i1 %138, i1 false
br i1 %139, label %114, label %140
140: ; preds = %114, %107
%141 = phi i32 [ %104, %107 ], [ %125, %114 ]
%142 = phi i32 [ %103, %107 ], [ %135, %114 ]
%143 = phi i32 [ %110, %107 ], [ %136, %114 ]
%144 = icmp ult i32 %143, 64976
%145 = add i32 %143, -65008
%146 = icmp ult i32 %145, 526
%147 = or i1 %144, %146
%148 = zext i1 %147 to i32
%149 = add nsw i32 %142, %148
%150 = icmp eq i32 %141, 0
br i1 %150, label %151, label %102
151: ; preds = %102, %140, %96
%152 = phi i32 [ 0, %96 ], [ %149, %140 ], [ %103, %102 ]
%153 = sitofp i32 %152 to double
%154 = fmul double %153, 1.000000e+02
%155 = load i32, i32* %6
%156 = add nsw i32 %155, 1
%157 = load i32, i32* %5
%158 = sub i32 %156, %157
%159 = sitofp i32 %158 to double
%160 = fdiv double %154, %159
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), double %160, i32 %157, i32 %155, i8* %12)
%162 = call i32 @exit(i32 0)
unreachable
}