#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*/ table_b2_max;
typedef int /*<<< orphan*/ table;
typedef int /*<<< orphan*/ line;
typedef int c1;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ my_getline(char *, int, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char const *, char *);
int strtol(char const *, char **, int /*<<< orphan*/);
void handle_jis(FILE **fp, const char *name, const char *filename) {
  int c1, c2, b1, b2, b1_max, b2_max, i, j, nb, n;
  int table[94 * 94];
  int table_b2_max[94];
  char line[1024];
  const char *p;
  int is_jis208;
  if (!strcmp(name, "JIS0208")) {
    is_jis208 = 1;
    name = "jis208";
  } else if (!strcmp(name, "JIS0212")) {
    is_jis208 = 0;
    name = "jis212";
  } else {
    fprintf(stderr, "%s: unsupported JIS file\n", filename);
    return;
  }
  memset(table, 0, sizeof(table));
  memset(table_b2_max, 0, sizeof(table_b2_max));
  b1_max = 0;
  b2_max = 0;
  nb = 0;
  for (;;) {
    if (!my_getline(line, sizeof(line), *fp, 1))
      break;
    p = line;
    if (is_jis208)
      c1 = strtol(p, (char **)&p, 0);
    c1 = strtol(p, (char **)&p, 0);
    c2 = strtol(p, (char **)&p, 0);
    b1 = (c1 >> 8) & 0xff;
    b2 = (c1)&0xff;
    b1 = b1 - 0x21;
    b2 = b2 - 0x21;
    if (b1 > b1_max)
      b1_max = b1;
    if (b2 > b2_max)
      b2_max = b2;
    if (b2 > table_b2_max[b1])
      table_b2_max[b1] = b2;
    table[b1 * 94 + b2] = c2;
    nb++;
  }
  printf("/* max row = %d. The following rows are excluded:\n   ", b1_max);
  n = 0;
  for (i = 0; i <= b1_max; i++) {
    if (table_b2_max[i] == 0) {
      printf(" %d", i);
    } else {
      n++;
    }
  }
  printf(", density=%d%% */\n", nb * 100 / (n * (b2_max + 1)));
  printf("static unsigned short const table_%s[%d] = {\n", name,
         n * (b2_max + 1));
  n = 0;
  for (i = 0; i <= b1_max; i++) {
    if (table_b2_max[i] != 0) {
      for (j = 0; j <= b2_max; j++) {
        if ((n & 7) == 0)
          printf("   ");
        printf(" 0x%04x,", table[i * 94 + j]);
        if ((n++ & 7) == 7)
          printf("\n");
      }
    }
  }
  if ((n & 7) != 0)
    printf("\n");
  printf("};\n\n");
}


x86 assembly (clang, -O0):
<handle_jis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8fe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11aa <handle_jis+0x4a>
movl   $0x1,-0x8fdc(%rbp)
lea    0xe67(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1200 <handle_jis+0xa0>
mov    -0x10(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11dd <handle_jis+0x7d>
movl   $0x0,-0x8fdc(%rbp)
lea    0xe43(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11fb <handle_jis+0x9b>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe2d(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1500 <handle_jis+0x3a0>
jmp    1200 <handle_jis+0xa0>
lea    -0x8a50(%rbp),%rdi
xor    %esi,%esi
mov    $0x8a10,%edx
call   1040 <memset@plt>
lea    -0x8bd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x178,%edx
call   1040 <memset@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x8fd0(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    $0x400,%esi
mov    $0x1,%ecx
call   1080 <my_getline@plt>
cmp    $0x0,%eax
jne    1266 <handle_jis+0x106>
jmp    135b <handle_jis+0x1fb>
lea    -0x8fd0(%rbp),%rax
mov    %rax,-0x8fd8(%rbp)
cmpl   $0x0,-0x8fdc(%rbp)
je     1299 <handle_jis+0x139>
mov    -0x8fd8(%rbp),%rdi
lea    -0x8fd8(%rbp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8fd8(%rbp),%rdi
lea    -0x8fd8(%rbp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8fd8(%rbp),%rdi
lea    -0x8fd8(%rbp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x21,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
sub    $0x21,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jle    1306 <handle_jis+0x1a6>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    1318 <handle_jis+0x1b8>
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
movslq -0x24(%rbp),%rcx
cmp    -0x8bd0(%rbp,%rcx,4),%eax
jle    133a <handle_jis+0x1da>
mov    -0x28(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x8bd0(%rbp,%rax,4)
mov    -0x20(%rbp),%ecx
imul   $0x5e,-0x24(%rbp),%eax
add    -0x28(%rbp),%eax
cltq
mov    %ecx,-0x8a50(%rbp,%rax,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    123b <handle_jis+0xdb>
mov    -0x2c(%rbp),%esi
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     13ca <handle_jis+0x26a>
movslq -0x34(%rbp),%rax
cmpl   $0x0,-0x8bd0(%rbp,%rax,4)
jne    13ae <handle_jis+0x24e>
mov    -0x34(%rbp),%esi
lea    0xccc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13b7 <handle_jis+0x257>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13bc <handle_jis+0x25c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    137a <handle_jis+0x21a>
imul   $0x64,-0x3c(%rbp),%eax
mov    -0x40(%rbp),%ecx
mov    -0x30(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xc8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x40(%rbp),%edx
mov    -0x30(%rbp),%eax
add    $0x1,%eax
imul   %eax,%edx
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     14d5 <handle_jis+0x375>
movslq -0x34(%rbp),%rax
cmpl   $0x0,-0x8bd0(%rbp,%rax,4)
je     14c2 <handle_jis+0x362>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     14bd <handle_jis+0x35d>
mov    -0x40(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    1467 <handle_jis+0x307>
lea    0xc0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0x5e,-0x34(%rbp),%eax
add    -0x38(%rbp),%eax
cltq
mov    -0x8a50(%rbp,%rax,4),%esi
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp)
and    $0x7,%eax
cmp    $0x7,%eax
jne    14aa <handle_jis+0x34a>
lea    0xc1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14af <handle_jis+0x34f>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    143e <handle_jis+0x2de>
jmp    14c2 <handle_jis+0x362>
jmp    14c7 <handle_jis+0x367>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1419 <handle_jis+0x2b9>
mov    -0x40(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
je     14f2 <handle_jis+0x392>
lea    0xbd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xbc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x8fe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_jis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8fc8,%rsp
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,0x8(%rsp)
lea    0xe5d(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
mov    %eax,0x4(%rsp)
test   %eax,%eax
je     11ef <handle_jis+0x6f>
lea    0xe55(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11f8 <handle_jis+0x78>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe48(%rip),%rsi
mov    %rbx,%rdx
add    $0x8fc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <fprintf@plt>
lea    0xe12(%rip),%rbx
jmp    11ff <handle_jis+0x7f>
lea    0xe18(%rip),%rbx
lea    0x5b0(%rsp),%rdi
xor    %ebp,%ebp
xor    %esi,%esi
mov    $0x8a10,%edx
call   1060 <memset@plt>
lea    0x30(%rsp),%rdi
xor    %esi,%esi
mov    $0x178,%edx
call   1060 <memset@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0x1b0(%rsp),%r15
mov    %r15,%rdi
mov    $0x400,%esi
mov    $0x1,%ecx
call   10a0 <my_getline@plt>
test   %eax,%eax
mov    %rbx,0x10(%rsp)
je     132c <handle_jis+0x1ac>
lea    0x18(%rsp),%r14
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    12a0 <handle_jis+0x120>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
imul   $0x5e,%edx,%edx
add    %ecx,%edx
movslq %edx,%rcx
mov    %eax,0x5b0(%rsp,%rcx,4)
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
mov    %r15,%rdi
mov    $0x400,%esi
mov    $0x1,%ecx
call   10a0 <my_getline@plt>
add    $0x64,%ebp
test   %eax,%eax
je     130f <handle_jis+0x18f>
mov    %r15,0x18(%rsp)
mov    %r15,%rdi
cmpl   $0x0,0x4(%rsp)
jne    12c1 <handle_jis+0x141>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    0x18(%rsp),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,%ebx
mov    0x18(%rsp),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
movzbl %bh,%esi
movzbl %bl,%ecx
lea    -0x21(%rsi),%rdx
mov    %esi,%edi
add    $0xffffffdf,%edi
add    $0xffffffdf,%ecx
cmp    %r12d,%edi
cmovg  %edi,%r12d
cmp    %r13d,%ecx
cmovg  %ecx,%r13d
cmp    -0x54(%rsp,%rsi,4),%ecx
jle    1270 <handle_jis+0xf0>
mov    %ecx,0x30(%rsp,%rdx,4)
jmp    1270 <handle_jis+0xf0>
lea    0xd22(%rip),%rdi
xor    %r15d,%r15d
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
jns    1344 <handle_jis+0x1c4>
mov    $0x1,%bl
jmp    1389 <handle_jis+0x209>
lea    0xd05(%rip),%rdi
xor    %ebp,%ebp
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %r13d,%r13d
xor    %r12d,%r12d
mov    %r12,0x8(%rsp)
add    $0x1,%r12d
lea    0xd1a(%rip),%r14
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    136d <handle_jis+0x1ed>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
add    $0x1,%rbx
cmp    %rbx,%r12
je     1382 <handle_jis+0x202>
cmpl   $0x0,0x30(%rsp,%rbx,4)
jne    1360 <handle_jis+0x1e0>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1364 <handle_jis+0x1e4>
xor    %ebx,%ebx
mov    0x8(%rsp),%r12
lea    0x1(%r13),%r14d
imul   %r14d,%r15d
mov    %ebp,%eax
cltd
idiv   %r15d
lea    0xcd4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcd7(%rip),%rdi
mov    0x10(%rsp),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
test   %bl,%bl
jne    14a3 <handle_jis+0x323>
add    $0x1,%r12d
mov    %r12,0x8(%rsp)
mov    %r14d,%ebx
xor    %eax,%eax
xor    %r12d,%r12d
xor    %ecx,%ecx
mov    %r13,0x28(%rsp)
mov    %r14d,0x24(%rsp)
jmp    1415 <handle_jis+0x295>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x24(%rsp),%r14d
mov    0x4(%rsp),%ecx
add    %r14d,%ecx
mov    0x28(%rsp),%r13
mov    0x10(%rsp),%rax
add    $0x1,%r12
add    $0x5e,%rax
cmp    0x8(%rsp),%r12
je     1494 <handle_jis+0x314>
cmpl   $0x0,0x30(%rsp,%r12,4)
je     1406 <handle_jis+0x286>
test   %r13d,%r13d
js     1406 <handle_jis+0x286>
mov    %rax,0x10(%rsp)
and    $0xfffffffe,%eax
lea    (%rsp,%rax,4),%r13
add    $0x5b0,%r13
mov    %ecx,0x4(%rsp)
mov    %ecx,%r15d
xor    %r14d,%r14d
jmp    1459 <handle_jis+0x2d9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    %r14,%rbx
je     13f0 <handle_jis+0x270>
lea    (%r15,%r14,1),%ebp
and    $0x7,%ebp
jne    1470 <handle_jis+0x2f0>
lea    0xc01(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13,%r14,4),%esi
lea    0xc37(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x7,%ebp
jne    1450 <handle_jis+0x2d0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1450 <handle_jis+0x2d0>
test   $0x7,%cl
je     14a3 <handle_jis+0x323>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc12(%rip),%rdi
call   1040 <puts@plt>
add    $0x8fc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"JIS0208\00"
@.str.1 = [7 x i8] c"jis208\00"
@.str.2 = [8 x i8] c"JIS0212\00"
@.str.3 = [7 x i8] c"jis212\00"
@stderr = global i32 0
@.str.4 = [26 x i8] c"%s: unsupported JIS file\0A\00"
@.str.5 = [54 x i8] c"/* max row = %d. The following rows are excluded:\0A \00"
@.str.6 = [4 x i8] c" %d\00"
@.str.7 = [19 x i8] c", density=%d%% */\0A\00"
@.str.8 = [46 x i8] c"static unsigned short const table_%s[%d] = {\0A\00"
@.str.9 = [4 x i8] c" \00"
@.str.10 = [9 x i8] c" 0x%04x,\00"
@.str.11 = [2 x i8] c"\0A\00"
@.str.12 = [5 x i8] c"};\0A\0A\00"
define void @handle_jis(i32** %0, i8* %1, i8* %2) {
%4 = alloca i32**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [8836 x i32]
%18 = alloca [94 x i32]
%19 = alloca [1024 x i8]
%20 = alloca i8*
%21 = alloca i32
store i32** %0, i32*** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%22 = load i8*, i8** %5
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %3
store i32 1, i32* %21
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %36
26: ; preds = %3
%27 = load i8*, i8** %5
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %26
store i32 0, i32* %21
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %35
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %6
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %33)
br label %193
35: ; preds = %30
br label %36
36: ; preds = %35, %25
%37 = getelementptr inbounds [8836 x i32], [8836 x i32]* %17, i64 0, i64 0
%38 = call i32 @memset(i32* %37, i32 0, i32 35344)
%39 = getelementptr inbounds [94 x i32], [94 x i32]* %18, i64 0, i64 0
%40 = call i32 @memset(i32* %39, i32 0, i32 376)
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %15
br label %41
41: ; preds = %92, %36
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%43 = load i32**, i32*** %4
%44 = load i32*, i32** %43
%45 = call i32 @my_getline(i8* %42, i32 1024, i32* %44, i32 1)
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %41
br label %102
48: ; preds = %41
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
store i8* %49, i8** %20
%50 = load i32, i32* %21
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i8*, i8** %20
%54 = call i32 @strtol(i8* %53, i8** %20, i32 0)
store i32 %54, i32* %7
br label %55
55: ; preds = %52, %48
%56 = load i8*, i8** %20
%57 = call i32 @strtol(i8* %56, i8** %20, i32 0)
store i32 %57, i32* %7
%58 = load i8*, i8** %20
%59 = call i32 @strtol(i8* %58, i8** %20, i32 0)
store i32 %59, i32* %8
%60 = load i32, i32* %7
%61 = ashr i32 %60, 8
%62 = and i32 %61, 255
store i32 %62, i32* %9
%63 = load i32, i32* %7
%64 = and i32 %63, 255
store i32 %64, i32* %10
%65 = load i32, i32* %9
%66 = sub nsw i32 %65, 33
store i32 %66, i32* %9
%67 = load i32, i32* %10
%68 = sub nsw i32 %67, 33
store i32 %68, i32* %10
%69 = load i32, i32* %9
%70 = load i32, i32* %11
%71 = icmp sgt i32 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %55
%73 = load i32, i32* %9
store i32 %73, i32* %11
br label %74
74: ; preds = %72, %55
%75 = load i32, i32* %10
%76 = load i32, i32* %12
%77 = icmp sgt i32 %75, %76
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = load i32, i32* %10
store i32 %79, i32* %12
br label %80
80: ; preds = %78, %74
%81 = load i32, i32* %10
%82 = load i32, i32* %9
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [94 x i32], [94 x i32]* %18, i64 0, i64 %83
%85 = load i32, i32* %84
%86 = icmp sgt i32 %81, %85
br i1 %86, label %87, label %92
87: ; preds = %80
%88 = load i32, i32* %10
%89 = load i32, i32* %9
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [94 x i32], [94 x i32]* %18, i64 0, i64 %90
store i32 %88, i32* %91
br label %92
92: ; preds = %87, %80
%93 = load i32, i32* %8
%94 = load i32, i32* %9
%95 = mul nsw i32 %94, 94
%96 = load i32, i32* %10
%97 = add nsw i32 %95, %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [8836 x i32], [8836 x i32]* %17, i64 0, i64 %98
store i32 %93, i32* %99
%100 = load i32, i32* %15
%101 = add nsw i32 %100, 1
store i32 %101, i32* %15
br label %41
102: ; preds = %47
%103 = load i32, i32* %11
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i32 %103)
store i32 0, i32* %16
store i32 0, i32* %13
br label %105
105: ; preds = %122, %102
%106 = load i32, i32* %13
%107 = load i32, i32* %11
%108 = icmp sle i32 %106, %107
br i1 %108, label %109, label %125
109: ; preds = %105
%110 = load i32, i32* %13
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [94 x i32], [94 x i32]* %18, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %118
115: ; preds = %109
%116 = load i32, i32* %13
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %116)
br label %121
118: ; preds = %109
%119 = load i32, i32* %16
%120 = add nsw i32 %119, 1
store i32 %120, i32* %16
br label %121
121: ; preds = %118, %115
br label %122
122: ; preds = %121
%123 = load i32, i32* %13
%124 = add nsw i32 %123, 1
store i32 %124, i32* %13
br label %105
125: ; preds = %105
%126 = load i32, i32* %15
%127 = mul nsw i32 %126, 100
%128 = load i32, i32* %16
%129 = load i32, i32* %12
%130 = add nsw i32 %129, 1
%131 = mul nsw i32 %128, %130
%132 = sdiv i32 %127, %131
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %132)
%134 = load i8*, i8** %5
%135 = load i32, i32* %16
%136 = load i32, i32* %12
%137 = add nsw i32 %136, 1
%138 = mul nsw i32 %135, %137
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i8* %134, i32 %138)
store i32 0, i32* %16
store i32 0, i32* %13
br label %140
140: ; preds = %182, %125
%141 = load i32, i32* %13
%142 = load i32, i32* %11
%143 = icmp sle i32 %141, %142
br i1 %143, label %144, label %185
144: ; preds = %140
%145 = load i32, i32* %13
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [94 x i32], [94 x i32]* %18, i64 0, i64 %146
%148 = load i32, i32* %147
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %181
150: ; preds = %144
store i32 0, i32* %14
br label %151
151: ; preds = %177, %150
%152 = load i32, i32* %14
%153 = load i32, i32* %12
%154 = icmp sle i32 %152, %153
br i1 %154, label %155, label %180
155: ; preds = %151
%156 = load i32, i32* %16
%157 = and i32 %156, 7
%158 = icmp eq i32 %157, 0
br i1 %158, label %159, label %161
159: ; preds = %155
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %161
161: ; preds = %159, %155
%162 = load i32, i32* %13
%163 = mul nsw i32 %162, 94
%164 = load i32, i32* %14
%165 = add nsw i32 %163, %164
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [8836 x i32], [8836 x i32]* %17, i64 0, i64 %166
%168 = load i32, i32* %167
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %168)
%170 = load i32, i32* %16
%171 = add nsw i32 %170, 1
store i32 %171, i32* %16
%172 = and i32 %170, 7
%173 = icmp eq i32 %172, 7
br i1 %173, label %174, label %176
174: ; preds = %161
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %176
176: ; preds = %174, %161
br label %177
177: ; preds = %176
%178 = load i32, i32* %14
%179 = add nsw i32 %178, 1
store i32 %179, i32* %14
br label %151
180: ; preds = %151
br label %181
181: ; preds = %180, %144
br label %182
182: ; preds = %181
%183 = load i32, i32* %13
%184 = add nsw i32 %183, 1
store i32 %184, i32* %13
br label %140
185: ; preds = %140
%186 = load i32, i32* %16
%187 = and i32 %186, 7
%188 = icmp ne i32 %187, 0
br i1 %188, label %189, label %191
189: ; preds = %185
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %191
191: ; preds = %189, %185
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %193
193: ; preds = %191, %31
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"JIS0208\00"
@.str.1 = [7 x i8] c"jis208\00"
@.str.2 = [8 x i8] c"JIS0212\00"
@.str.3 = [7 x i8] c"jis212\00"
@stderr = global i32 0
@.str.4 = [26 x i8] c"%s: unsupported JIS file\0A\00"
@.str.5 = [54 x i8] c"/* max row = %d. The following rows are excluded:\0A \00"
@.str.6 = [4 x i8] c" %d\00"
@.str.7 = [19 x i8] c", density=%d%% */\0A\00"
@.str.8 = [46 x i8] c"static unsigned short const table_%s[%d] = {\0A\00"
@.str.9 = [4 x i8] c" \00"
@.str.10 = [9 x i8] c" 0x%04x,\00"
@str = [4 x i8] c"};\0A\00"
define void @handle_jis(i32** nocapture %0, i8* nocapture %1, i8* %2) {
%4 = alloca [8836 x i32]
%5 = alloca [94 x i32]
%6 = alloca [1024 x i8]
%7 = alloca i8*
%8 = bitcast [8836 x i32]* %4 to i8*
%9 = bitcast [94 x i32]* %5 to i8*
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = bitcast i8** %7 to i8*
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %3
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %2)
br label %149
20: ; preds = %14, %3
%21 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %14 ]
%22 = getelementptr inbounds [8836 x i32], [8836 x i32]* %4, i64 0, i64 0
%23 = call i32 @memset(i32* %22, i32 0, i32 35344)
%24 = getelementptr inbounds [94 x i32], [94 x i32]* %5, i64 0, i64 0
%25 = call i32 @memset(i32* %24, i32 0, i32 376)
%26 = load i32*, i32** %0
%27 = call i32 @my_getline(i8* %10, i32 1024, i32* %26, i32 1)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %20
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i32 0)
br label %70
31: ; preds = %20, %57
%32 = phi i32 [ %62, %57 ], [ 0, %20 ]
%33 = phi i32 [ %51, %57 ], [ 0, %20 ]
%34 = phi i32 [ %49, %57 ], [ 0, %20 ]
store i8* %10, i8** %7
br i1 %13, label %35, label %38
35: ; preds = %31
%36 = call i32 @strtol(i8* %10, i8** %7, i32 0)
%37 = load i8*, i8** %7
br label %38
38: ; preds = %35, %31
%39 = phi i8* [ %37, %35 ], [ %10, %31 ]
%40 = call i32 @strtol(i8* %39, i8** %7, i32 0)
%41 = load i8*, i8** %7
%42 = call i32 @strtol(i8* %41, i8** %7, i32 0)
%43 = lshr i32 %40, 8
%44 = and i32 %43, 255
%45 = and i32 %40, 255
%46 = add nsw i32 %44, -33
%47 = add nsw i32 %45, -33
%48 = icmp sgt i32 %46, %34
%49 = select i1 %48, i32 %46, i32 %34
%50 = icmp sgt i32 %47, %33
%51 = select i1 %50, i32 %47, i32 %33
%52 = sext i32 %46 to i64
%53 = getelementptr inbounds [94 x i32], [94 x i32]* %5, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = icmp sgt i32 %47, %54
br i1 %55, label %56, label %57
56: ; preds = %38
store i32 %47, i32* %53
br label %57
57: ; preds = %56, %38
%58 = mul nsw i32 %46, 94
%59 = add nsw i32 %58, %47
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [8836 x i32], [8836 x i32]* %4, i64 0, i64 %60
store i32 %42, i32* %61
%62 = add nuw nsw i32 %32, 1
%63 = load i32*, i32** %0
%64 = call i32 @my_getline(i8* %10, i32 1024, i32* %63, i32 1)
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %31
66: ; preds = %57
%67 = mul i32 %62, 100
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i32 %49)
%69 = icmp slt i32 %49, 0
br i1 %69, label %91, label %70
70: ; preds = %29, %66
%71 = phi i32 [ 0, %29 ], [ %67, %66 ]
%72 = phi i32 [ 0, %29 ], [ %51, %66 ]
%73 = phi i32 [ 0, %29 ], [ %49, %66 ]
%74 = add nuw i32 %73, 1
%75 = zext i32 %74 to i64
br label %76
76: ; preds = %70, %87
%77 = phi i64 [ 0, %70 ], [ %89, %87 ]
%78 = phi i32 [ 0, %70 ], [ %88, %87 ]
%79 = getelementptr inbounds [94 x i32], [94 x i32]* %5, i64 0, i64 %77
%80 = load i32, i32* %79
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %76
%83 = trunc i64 %77 to i32
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %83)
br label %87
85: ; preds = %76
%86 = add nsw i32 %78, 1
br label %87
87: ; preds = %82, %85
%88 = phi i32 [ %78, %82 ], [ %86, %85 ]
%89 = add nuw nsw i64 %77, 1
%90 = icmp eq i64 %89, %75
br i1 %90, label %91, label %76
91: ; preds = %87, %66
%92 = phi i1 [ true, %66 ], [ false, %87 ]
%93 = phi i32 [ %67, %66 ], [ %71, %87 ]
%94 = phi i32 [ %51, %66 ], [ %72, %87 ]
%95 = phi i32 [ %49, %66 ], [ %73, %87 ]
%96 = phi i32 [ 0, %66 ], [ %88, %87 ]
%97 = add i32 %94, 1
%98 = mul nsw i32 %96, %97
%99 = sdiv i32 %93, %98
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %99)
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i8* %21, i32 %98)
br i1 %92, label %147, label %102
102: ; preds = %91
%103 = icmp slt i32 %94, 0
%104 = add i32 %95, 1
%105 = zext i32 %104 to i64
%106 = zext i32 %97 to i64
br label %107
107: ; preds = %102, %138
%108 = phi i64 [ 0, %102 ], [ %140, %138 ]
%109 = phi i32 [ 0, %102 ], [ %139, %138 ]
%110 = getelementptr inbounds [94 x i32], [94 x i32]* %5, i64 0, i64 %108
%111 = load i32, i32* %110
%112 = icmp eq i32 %111, 0
%113 = select i1 %112, i1 true, i1 %103
br i1 %113, label %138, label %114
114: ; preds = %107
%115 = mul i64 %108, 94
%116 = and i64 %115, 4294967294
br label %117
117: ; preds = %114, %133
%118 = phi i64 [ 0, %114 ], [ %134, %133 ]
%119 = phi i32 [ %109, %114 ], [ %129, %133 ]
%120 = and i32 %119, 7
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %124
122: ; preds = %117
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %124
124: ; preds = %122, %117
%125 = add nuw nsw i64 %118, %116
%126 = getelementptr inbounds [8836 x i32], [8836 x i32]* %4, i64 0, i64 %125
%127 = load i32, i32* %126
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %127)
%129 = add nsw i32 %119, 1
%130 = icmp eq i32 %120, 7
br i1 %130, label %131, label %133
131: ; preds = %124
%132 = call i32 @putchar(i32 10)
br label %133
133: ; preds = %124, %131
%134 = add nuw nsw i64 %118, 1
%135 = icmp eq i64 %134, %106
br i1 %135, label %136, label %117
136: ; preds = %133
%137 = add i32 %97, %109
br label %138
138: ; preds = %136, %107
%139 = phi i32 [ %109, %107 ], [ %137, %136 ]
%140 = add nuw nsw i64 %108, 1
%141 = icmp eq i64 %140, %105
br i1 %141, label %142, label %107
142: ; preds = %138
%143 = and i32 %139, 7
%144 = icmp eq i32 %143, 0
br i1 %144, label %147, label %145
145: ; preds = %142
%146 = call i32 @putchar(i32 10)
br label %147
147: ; preds = %91, %145, %142
%148 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %149
149: ; preds = %147, %17
ret void
}