#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*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, unsigned int *, unsigned int *);
int /*<<< orphan*/ stderr;
int uniwidth(char *name) {
  FILE *f;
  char buf[1024];
  int low = -2, high = -2;
  f = fopen(name, "r");
  if (!f) {
    fprintf(stderr, "Couldn't open %s\n", name);
    return -1;
  }
  printf("\n/* Double-wide characters */\n");
  printf("\n");
  printf("struct interval width_table[] = {\n");
  while (fgets(buf, sizeof(buf), f)) {
    if ((buf[0] >= '0' && buf[0] <= '9') || (buf[0] >= 'A' && buf[0] <= 'F') ||
        (buf[0] >= 'a' && buf[0] <= 'f')) {
      unsigned l;
      unsigned h;
      int x, y, c;
      do {
        for (x = 0; buf[x] == ' ' || buf[x] == '\t'; ++x)
          ;
      } while (0);
      do {
        for (y = x; buf[y] && buf[y] != '#' && buf[y] != ';' && buf[y] != ' ' &&
                    buf[y] != '\t' && buf[y] != '\n' && buf[y] != '\r';
             ++y)
          ;
        c = buf[y];
        buf[y] = 0;
      } while (0);
      if (1 == sscanf(buf, "%x..%x", &l, &h))
        h = l;
      do {
        buf[y] = (char)c;
        x = y;
        if (buf[x] == ';')
          ++x;
        while (buf[x] == ' ' || buf[x] == '\t')
          ++x;
      } while (0);
      do {
        for (y = x; buf[y] && buf[y] != '#' && buf[y] != ';' &&
                    buf[y] != '\n' && buf[y] != '\r';
             ++y)
          ;
        c = buf[y];
        buf[y] = 0;
      } while (0);
      if (buf[x] == 'W' || buf[x] == 'F') {
        if ((int)l != high + 1) {
          if (low != -2) {
            printf("	{ 0x%x, 0x%x },\n", low, high);
          }
          low = (int)l;
          high = (int)h;
        } else {
          high = (int)h;
        }
      }
    }
  }
  fclose(f);
  if (low != -2) {
    printf("	{ 0x%x, 0x%x },\n", low, high);
  }
  printf("	{ 0x0, 0x0 }\n");
  printf("};\n");
  return 0;
}


x86 assembly (clang, -O0):
<uniwidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xfffffffe,-0x424(%rbp)
ff ff ff
movl   $0xfffffffe,-0x428(%rbp)
ff ff ff
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c7 <uniwidth+0x67>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe4c(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1712 <uniwidth+0x5b2>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     16bf <uniwidth+0x55f>
movsbl -0x420(%rbp),%eax
cmp    $0x30,%eax
jl     1230 <uniwidth+0xd0>
movsbl -0x420(%rbp),%eax
cmp    $0x39,%eax
jle    1270 <uniwidth+0x110>
movsbl -0x420(%rbp),%eax
cmp    $0x41,%eax
jl     1250 <uniwidth+0xf0>
movsbl -0x420(%rbp),%eax
cmp    $0x46,%eax
jle    1270 <uniwidth+0x110>
movsbl -0x420(%rbp),%eax
cmp    $0x61,%eax
jl     16ba <uniwidth+0x55a>
movsbl -0x420(%rbp),%eax
cmp    $0x66,%eax
jg     16ba <uniwidth+0x55a>
jmp    1275 <uniwidth+0x115>
movl   $0x0,-0x434(%rbp)
movslq -0x434(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x43d(%rbp)
je     12ba <uniwidth+0x15a>
movslq -0x434(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
sete   %al
mov    %al,-0x43d(%rbp)
mov    -0x43d(%rbp),%al
test   $0x1,%al
jne    12cd <uniwidth+0x16d>
jmp    12e6 <uniwidth+0x186>
jmp    12d2 <uniwidth+0x172>
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
jmp    127f <uniwidth+0x11f>
jmp    12eb <uniwidth+0x18b>
jmp    12f0 <uniwidth+0x190>
mov    -0x434(%rbp),%eax
mov    %eax,-0x438(%rbp)
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x43e(%rbp)
je     13d7 <uniwidth+0x277>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x23,%ecx
mov    %al,-0x43e(%rbp)
je     13d7 <uniwidth+0x277>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x3b,%ecx
mov    %al,-0x43e(%rbp)
je     13d7 <uniwidth+0x277>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x43e(%rbp)
je     13d7 <uniwidth+0x277>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x43e(%rbp)
je     13d7 <uniwidth+0x277>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x43e(%rbp)
je     13d7 <uniwidth+0x277>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
setne  %al
mov    %al,-0x43e(%rbp)
mov    -0x43e(%rbp),%al
test   $0x1,%al
jne    13ea <uniwidth+0x28a>
jmp    1403 <uniwidth+0x2a3>
jmp    13ef <uniwidth+0x28f>
mov    -0x438(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x438(%rbp)
jmp    12fc <uniwidth+0x19c>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
mov    %eax,-0x43c(%rbp)
movslq -0x438(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rdi
lea    0xc21(%rip),%rsi
lea    -0x42c(%rbp),%rdx
lea    -0x430(%rbp),%rcx
call   1070 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    1463 <uniwidth+0x303>
mov    -0x42c(%rbp),%eax
mov    %eax,-0x430(%rbp)
jmp    1468 <uniwidth+0x308>
mov    -0x43c(%rbp),%eax
mov    %al,%cl
movslq -0x438(%rbp),%rax
mov    %cl,-0x420(%rbp,%rax,1)
mov    -0x438(%rbp),%eax
mov    %eax,-0x434(%rbp)
movslq -0x434(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0x3b,%eax
jne    14b1 <uniwidth+0x351>
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
jmp    14b6 <uniwidth+0x356>
movslq -0x434(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x43f(%rbp)
je     14f1 <uniwidth+0x391>
movslq -0x434(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
sete   %al
mov    %al,-0x43f(%rbp)
mov    -0x43f(%rbp),%al
test   $0x1,%al
jne    1504 <uniwidth+0x3a4>
jmp    1518 <uniwidth+0x3b8>
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
jmp    14b6 <uniwidth+0x356>
jmp    151d <uniwidth+0x3bd>
jmp    1522 <uniwidth+0x3c2>
mov    -0x434(%rbp),%eax
mov    %eax,-0x438(%rbp)
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x440(%rbp)
je     15c9 <uniwidth+0x469>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x23,%ecx
mov    %al,-0x440(%rbp)
je     15c9 <uniwidth+0x469>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x3b,%ecx
mov    %al,-0x440(%rbp)
je     15c9 <uniwidth+0x469>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x440(%rbp)
je     15c9 <uniwidth+0x469>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
setne  %al
mov    %al,-0x440(%rbp)
mov    -0x440(%rbp),%al
test   $0x1,%al
jne    15dc <uniwidth+0x47c>
jmp    15f5 <uniwidth+0x495>
jmp    15e1 <uniwidth+0x481>
mov    -0x438(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x438(%rbp)
jmp    152e <uniwidth+0x3ce>
movslq -0x438(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
mov    %eax,-0x43c(%rbp)
movslq -0x438(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
movslq -0x434(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0x57,%eax
je     1649 <uniwidth+0x4e9>
movslq -0x434(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0x46,%eax
jne    16b5 <uniwidth+0x555>
mov    -0x42c(%rbp),%eax
mov    -0x428(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     16a4 <uniwidth+0x544>
cmpl   $0xfffffffe,-0x424(%rbp)
je     1687 <uniwidth+0x527>
mov    -0x424(%rbp),%esi
mov    -0x428(%rbp),%edx
lea    0x9dd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x42c(%rbp),%eax
mov    %eax,-0x424(%rbp)
mov    -0x430(%rbp),%eax
mov    %eax,-0x428(%rbp)
jmp    16b0 <uniwidth+0x550>
mov    -0x430(%rbp),%eax
mov    %eax,-0x428(%rbp)
jmp    16b5 <uniwidth+0x555>
jmp    16ba <uniwidth+0x55a>
jmp    11f1 <uniwidth+0x91>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0xfffffffe,-0x424(%rbp)
je     16ef <uniwidth+0x58f>
mov    -0x424(%rbp),%esi
mov    -0x428(%rbp),%edx
lea    0x975(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x979(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x97a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uniwidth>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rdi,%rbp
lea    0xe65(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13a3 <uniwidth+0x223>
mov    %rax,%rbx
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe82(%rip),%rdi
call   1040 <puts@plt>
lea    0x20(%rsp),%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     13c2 <uniwidth+0x242>
mov    $0xfffffffe,%eax
mov    %rax,0x18(%rsp)
movabs $0x800000900002601,%r13
movabs $0x800000800002401,%rbp
movl   $0xfffffffe,0xc(%rsp)
ff
jmp    1244 <uniwidth+0xc4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%eax
mov    %rax,0x18(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     137d <uniwidth+0x1fd>
mov    0x20(%rsp),%al
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     126b <uniwidth+0xeb>
lea    -0x41(%rax),%ecx
cmp    $0x25,%cl
ja     1229 <uniwidth+0xa9>
movzbl %cl,%ecx
movabs $0x3f0000003f,%rdx
bt     %rcx,%rdx
jae    1229 <uniwidth+0xa9>
xor    %ecx,%ecx
jmp    1279 <uniwidth+0xf9>
nop
movzbl 0x21(%rsp,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x9,%al
je     1270 <uniwidth+0xf0>
cmp    $0x20,%al
je     1270 <uniwidth+0xf0>
mov    %ecx,%r15d
jmp    1294 <uniwidth+0x114>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15
movzbl 0x20(%rsp,%r15,1),%r12d
cmp    $0x3b,%r12
ja     1290 <uniwidth+0x110>
bt     %r12,%r13
jae    1290 <uniwidth+0x110>
mov    %r15d,%r14d
movb   $0x0,0x20(%rsp,%r14,1)
lea    0x20(%rsp),%rdi
lea    0xd59(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    12d7 <uniwidth+0x157>
mov    0x14(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %r12b,0x20(%rsp,%r14,1)
xor    %eax,%eax
cmp    $0x3b,%r12b
sete   %al
add    %r15d,%eax
jmp    12f4 <uniwidth+0x174>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
movzbl 0x20(%rsp,%rax,1),%ecx
cmp    $0x9,%cl
je     12f0 <uniwidth+0x170>
cmp    $0x20,%cl
je     12f0 <uniwidth+0x170>
mov    %eax,%eax
mov    %rax,%rcx
jmp    1314 <uniwidth+0x194>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rcx
movzbl 0x20(%rsp,%rcx,1),%edx
cmp    $0x3b,%rdx
ja     1310 <uniwidth+0x190>
bt     %rdx,%rbp
jae    1310 <uniwidth+0x190>
mov    %ecx,%ecx
movb   $0x0,0x20(%rsp,%rcx,1)
mov    0x20(%rsp,%rax,1),%al
cmp    $0x57,%al
je     133c <uniwidth+0x1bc>
cmp    $0x46,%al
jne    1229 <uniwidth+0xa9>
mov    0x14(%rsp),%eax
mov    0x18(%rsp),%rdx
lea    0x1(%rdx),%ecx
cmp    %ecx,%eax
je     1220 <uniwidth+0xa0>
mov    0xc(%rsp),%esi
cmp    $0xfffffffe,%esi
je     136b <uniwidth+0x1eb>
lea    0xcbb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%rsp),%eax
mov    0x10(%rsp),%ecx
mov    %rcx,0x18(%rsp)
mov    %eax,0xc(%rsp)
jmp    1229 <uniwidth+0xa9>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0xc(%rsp),%esi
cmp    $0xfffffffe,%esi
je     13ca <uniwidth+0x24a>
lea    0xc86(%rip),%rdi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13ca <uniwidth+0x24a>
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
lea    0xc4f(%rip),%rsi
mov    %rbp,%rdx
call   1080 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    13e4 <uniwidth+0x264>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xc9c(%rip),%rdi
call   1040 <puts@plt>
lea    0xc9e(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"Couldn't open %s\0A\00"
@.str.2 = [31 x i8] c"\0A/* Double-wide characters */\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [35 x i8] c"struct interval width_table[] = {\0A\00"
@.str.5 = [7 x i8] c"%x..%x\00"
@.str.6 = [18 x i8] c"\09{ 0x%x, 0x%x },\0A\00"
@.str.7 = [15 x i8] c"\09{ 0x0, 0x0 }\0A\00"
@.str.8 = [4 x i8] c"};\0A\00"
define i32 @uniwidth(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
store i32 -2, i32* %6
store i32 -2, i32* %7
%13 = load i8*, i8** %3
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %4
%15 = load i32*, i32** %4
%16 = icmp ne i32* %15, null
br i1 %16, label %21, label %17
17: ; preds = %1
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %3
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %19)
store i32 -1, i32* %2
br label %293
21: ; preds = %1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %280, %21
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%27 = load i32*, i32** %4
%28 = call i64 @fgets(i8* %26, i32 1024, i32* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %281
30: ; preds = %25
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp sge i32 %33, 48
br i1 %34, label %35, label %40
35: ; preds = %30
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp sle i32 %38, 57
br i1 %39, label %60, label %40
40: ; preds = %35, %30
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp sge i32 %43, 65
br i1 %44, label %45, label %50
45: ; preds = %40
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp sle i32 %48, 70
br i1 %49, label %60, label %50
50: ; preds = %45, %40
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp sge i32 %53, 97
br i1 %54, label %55, label %280
55: ; preds = %50
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp sle i32 %58, 102
br i1 %59, label %60, label %280
60: ; preds = %55, %45, %35
br label %61
61: ; preds = %60
store i32 0, i32* %10
br label %62
62: ; preds = %79, %61
%63 = load i32, i32* %10
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 32
br i1 %68, label %76, label %69
69: ; preds = %62
%70 = load i32, i32* %10
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %71
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 9
br label %76
76: ; preds = %69, %62
%77 = phi i1 [ true, %62 ], [ %75, %69 ]
br i1 %77, label %78, label %82
78: ; preds = %76
br label %79
79: ; preds = %78
%80 = load i32, i32* %10
%81 = add nsw i32 %80, 1
store i32 %81, i32* %10
br label %62
82: ; preds = %76
br label %83
83: ; preds = %82
br label %84
84: ; preds = %83
%85 = load i32, i32* %10
store i32 %85, i32* %11
br label %86
86: ; preds = %138, %84
%87 = load i32, i32* %11
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %135
93: ; preds = %86
%94 = load i32, i32* %11
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %95
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp ne i32 %98, 35
br i1 %99, label %100, label %135
100: ; preds = %93
%101 = load i32, i32* %11
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %102
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 59
br i1 %106, label %107, label %135
107: ; preds = %100
%108 = load i32, i32* %11
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp ne i32 %112, 32
br i1 %113, label %114, label %135
114: ; preds = %107
%115 = load i32, i32* %11
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %116
%118 = load i8, i8* %117
%119 = sext i8 %118 to i32
%120 = icmp ne i32 %119, 9
br i1 %120, label %121, label %135
121: ; preds = %114
%122 = load i32, i32* %11
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %123
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp ne i32 %126, 10
br i1 %127, label %128, label %135
128: ; preds = %121
%129 = load i32, i32* %11
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %130
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = icmp ne i32 %133, 13
br label %135
135: ; preds = %128, %121, %114, %107, %100, %93, %86
%136 = phi i1 [ false, %121 ], [ false, %114 ], [ false, %107 ], [ false, %100 ], [ false, %93 ], [ false, %86 ], [ %134, %128 ]
br i1 %136, label %137, label %141
137: ; preds = %135
br label %138
138: ; preds = %137
%139 = load i32, i32* %11
%140 = add nsw i32 %139, 1
store i32 %140, i32* %11
br label %86
141: ; preds = %135
%142 = load i32, i32* %11
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %143
%145 = load i8, i8* %144
%146 = sext i8 %145 to i32
store i32 %146, i32* %12
%147 = load i32, i32* %11
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %148
store i8 0, i8* %149
br label %150
150: ; preds = %141
%151 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%152 = call i32 @sscanf(i8* %151, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %8, i32* %9)
%153 = icmp eq i32 1, %152
br i1 %153, label %154, label %156
154: ; preds = %150
%155 = load i32, i32* %8
store i32 %155, i32* %9
br label %156
156: ; preds = %154, %150
br label %157
157: ; preds = %156
%158 = load i32, i32* %12
%159 = trunc i32 %158 to i8
%160 = load i32, i32* %11
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %161
store i8 %159, i8* %162
%163 = load i32, i32* %11
store i32 %163, i32* %10
%164 = load i32, i32* %10
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %165
%167 = load i8, i8* %166
%168 = sext i8 %167 to i32
%169 = icmp eq i32 %168, 59
br i1 %169, label %170, label %173
170: ; preds = %157
%171 = load i32, i32* %10
%172 = add nsw i32 %171, 1
store i32 %172, i32* %10
br label %173
173: ; preds = %170, %157
br label %174
174: ; preds = %190, %173
%175 = load i32, i32* %10
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %176
%178 = load i8, i8* %177
%179 = sext i8 %178 to i32
%180 = icmp eq i32 %179, 32
br i1 %180, label %188, label %181
181: ; preds = %174
%182 = load i32, i32* %10
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %183
%185 = load i8, i8* %184
%186 = sext i8 %185 to i32
%187 = icmp eq i32 %186, 9
br label %188
188: ; preds = %181, %174
%189 = phi i1 [ true, %174 ], [ %187, %181 ]
br i1 %189, label %190, label %193
190: ; preds = %188
%191 = load i32, i32* %10
%192 = add nsw i32 %191, 1
store i32 %192, i32* %10
br label %174
193: ; preds = %188
br label %194
194: ; preds = %193
br label %195
195: ; preds = %194
%196 = load i32, i32* %10
store i32 %196, i32* %11
br label %197
197: ; preds = %235, %195
%198 = load i32, i32* %11
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %199
%201 = load i8, i8* %200
%202 = sext i8 %201 to i32
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %232
204: ; preds = %197
%205 = load i32, i32* %11
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %206
%208 = load i8, i8* %207
%209 = sext i8 %208 to i32
%210 = icmp ne i32 %209, 35
br i1 %210, label %211, label %232
211: ; preds = %204
%212 = load i32, i32* %11
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %213
%215 = load i8, i8* %214
%216 = sext i8 %215 to i32
%217 = icmp ne i32 %216, 59
br i1 %217, label %218, label %232
218: ; preds = %211
%219 = load i32, i32* %11
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %220
%222 = load i8, i8* %221
%223 = sext i8 %222 to i32
%224 = icmp ne i32 %223, 10
br i1 %224, label %225, label %232
225: ; preds = %218
%226 = load i32, i32* %11
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %227
%229 = load i8, i8* %228
%230 = sext i8 %229 to i32
%231 = icmp ne i32 %230, 13
br label %232
232: ; preds = %225, %218, %211, %204, %197
%233 = phi i1 [ false, %218 ], [ false, %211 ], [ false, %204 ], [ false, %197 ], [ %231, %225 ]
br i1 %233, label %234, label %238
234: ; preds = %232
br label %235
235: ; preds = %234
%236 = load i32, i32* %11
%237 = add nsw i32 %236, 1
store i32 %237, i32* %11
br label %197
238: ; preds = %232
%239 = load i32, i32* %11
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %240
%242 = load i8, i8* %241
%243 = sext i8 %242 to i32
store i32 %243, i32* %12
%244 = load i32, i32* %11
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %245
store i8 0, i8* %246
br label %247
247: ; preds = %238
%248 = load i32, i32* %10
%249 = sext i32 %248 to i64
%250 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %249
%251 = load i8, i8* %250
%252 = sext i8 %251 to i32
%253 = icmp eq i32 %252, 87
br i1 %253, label %261, label %254
254: ; preds = %247
%255 = load i32, i32* %10
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %256
%258 = load i8, i8* %257
%259 = sext i8 %258 to i32
%260 = icmp eq i32 %259, 70
br i1 %260, label %261, label %279
261: ; preds = %254, %247
%262 = load i32, i32* %8
%263 = load i32, i32* %7
%264 = add nsw i32 %263, 1
%265 = icmp ne i32 %262, %264
br i1 %265, label %266, label %276
266: ; preds = %261
%267 = load i32, i32* %6
%268 = icmp ne i32 %267, -2
br i1 %268, label %269, label %273
269: ; preds = %266
%270 = load i32, i32* %6
%271 = load i32, i32* %7
%272 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %270, i32 %271)
br label %273
273: ; preds = %269, %266
%274 = load i32, i32* %8
store i32 %274, i32* %6
%275 = load i32, i32* %9
store i32 %275, i32* %7
br label %278
276: ; preds = %261
%277 = load i32, i32* %9
store i32 %277, i32* %7
br label %278
278: ; preds = %276, %273
br label %279
279: ; preds = %278, %254
br label %280
280: ; preds = %279, %55, %50
br label %25
281: ; preds = %25
%282 = load i32*, i32** %4
%283 = call i32 @fclose(i32* %282)
%284 = load i32, i32* %6
%285 = icmp ne i32 %284, -2
br i1 %285, label %286, label %290
286: ; preds = %281
%287 = load i32, i32* %6
%288 = load i32, i32* %7
%289 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %287, i32 %288)
br label %290
290: ; preds = %286, %281
%291 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%292 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %2
br label %293
293: ; preds = %290, %17
%294 = load i32, i32* %2
ret i32 %294
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"Couldn't open %s\0A\00"
@.str.5 = [7 x i8] c"%x..%x\00"
@.str.6 = [18 x i8] c"\09{ 0x%x, 0x%x },\0A\00"
@str = [30 x i8] c"\0A/* Double-wide characters */\00"
@str.9 = [34 x i8] c"struct interval width_table[] = {\00"
@str.10 = [14 x i8] c"\09{ 0x0, 0x0 }\00"
@str.11 = [3 x i8] c"};\00"
define i32 @uniwidth(i8* %0) {
%2 = alloca [1024 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %107
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.9, i64 0, i64 0))
%15 = call i64 @fgets(i8* %5, i32 1024, i32* %6)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 @fclose(i32* %6)
br label %104
19: ; preds = %11
%20 = bitcast i32* %3 to i8*
%21 = bitcast i32* %4 to i8*
br label %22
22: ; preds = %19, %94
%23 = phi i32 [ -2, %19 ], [ %96, %94 ]
%24 = phi i32 [ -2, %19 ], [ %95, %94 ]
%25 = load i8, i8* %5
%26 = freeze i8 %25
%27 = add i8 %26, -48
%28 = icmp ult i8 %27, 10
br i1 %28, label %30, label %29
29: ; preds = %22
switch i8 %26, label %94 [
i8 102, label %30
i8 101, label %30
i8 100, label %30
i8 99, label %30
i8 98, label %30
i8 97, label %30
i8 70, label %30
i8 69, label %30
i8 68, label %30
i8 67, label %30
i8 66, label %30
i8 65, label %30
]
30: ; preds = %29, %29, %29, %29, %29, %29, %29, %29, %29, %29, %29, %29, %22
br label %31
31: ; preds = %36, %30
%32 = phi i8 [ %39, %36 ], [ %26, %30 ]
%33 = phi i64 [ %37, %36 ], [ 0, %30 ]
switch i8 %32, label %34 [
i8 32, label %36
i8 9, label %36
]
34: ; preds = %31
%35 = and i64 %33, 4294967295
br label %40
36: ; preds = %31, %31
%37 = add nuw i64 %33, 1
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %37
%39 = load i8, i8* %38
br label %31
40: ; preds = %34, %44
%41 = phi i64 [ %35, %34 ], [ %45, %44 ]
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
switch i8 %43, label %44 [
i8 0, label %46
i8 35, label %46
i8 59, label %46
i8 32, label %46
i8 9, label %46
i8 10, label %46
i8 13, label %46
]
44: ; preds = %40
%45 = add nuw i64 %41, 1
br label %40
46: ; preds = %40, %40, %40, %40, %40, %40, %40
%47 = and i64 %41, 4294967295
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %47
store i8 0, i8* %48
%49 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %3, i32* %4)
%50 = icmp eq i32 %49, 1
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = load i32, i32* %3
store i32 %52, i32* %4
br label %53
53: ; preds = %46, %51
store i8 %43, i8* %48
%54 = icmp eq i8 %43, 59
%55 = zext i1 %54 to i64
%56 = add i64 %41, %55
%57 = and i64 %56, 4294967295
br label %58
58: ; preds = %65, %53
%59 = phi i64 [ %66, %65 ], [ %57, %53 ]
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %59
%61 = load i8, i8* %60
switch i8 %61, label %62 [
i8 32, label %65
i8 9, label %65
]
62: ; preds = %58
%63 = and i64 %59, 4294967295
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %63
br label %67
65: ; preds = %58, %58
%66 = add nuw i64 %59, 1
br label %58
67: ; preds = %62, %71
%68 = phi i64 [ %63, %62 ], [ %72, %71 ]
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %68
%70 = load i8, i8* %69
switch i8 %70, label %71 [
i8 0, label %73
i8 35, label %73
i8 59, label %73
i8 10, label %73
i8 13, label %73
]
71: ; preds = %67
%72 = add nuw i64 %68, 1
br label %67
73: ; preds = %67, %67, %67, %67, %67
%74 = and i64 %68, 4294967295
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %74
store i8 0, i8* %75
%76 = load i8, i8* %64
switch i8 %76, label %91 [
i8 87, label %77
i8 70, label %77
]
77: ; preds = %73, %73
%78 = load i32, i32* %3
%79 = add nsw i32 %23, 1
%80 = icmp eq i32 %78, %79
br i1 %80, label %89, label %81
81: ; preds = %77
%82 = icmp eq i32 %24, -2
br i1 %82, label %86, label %83
83: ; preds = %81
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %24, i32 %23)
%85 = load i32, i32* %3
br label %86
86: ; preds = %83, %81
%87 = phi i32 [ %85, %83 ], [ %78, %81 ]
%88 = load i32, i32* %4
br label %91
89: ; preds = %77
%90 = load i32, i32* %4
br label %91
91: ; preds = %73, %86, %89
%92 = phi i32 [ %87, %86 ], [ %24, %89 ], [ %24, %73 ]
%93 = phi i32 [ %88, %86 ], [ %90, %89 ], [ %23, %73 ]
br label %94
94: ; preds = %29, %91
%95 = phi i32 [ %92, %91 ], [ %24, %29 ]
%96 = phi i32 [ %93, %91 ], [ %23, %29 ]
%97 = call i64 @fgets(i8* %5, i32 1024, i32* %6)
%98 = icmp eq i64 %97, 0
br i1 %98, label %99, label %22
99: ; preds = %94
%100 = call i32 @fclose(i32* %6)
%101 = icmp eq i32 %95, -2
br i1 %101, label %104, label %102
102: ; preds = %99
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %95, i32 %96)
br label %104
104: ; preds = %17, %102, %99
%105 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.10, i64 0, i64 0))
%106 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.11, i64 0, i64 0))
br label %107
107: ; preds = %104, %8
%108 = phi i32 [ 0, %104 ], [ -1, %8 ]
ret i32 %108
}