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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ getline(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ isspace(char const);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcasecmp(char *, char *);
int strtol(char const *, char **, int /*<<< orphan*/);
void handle_cp(FILE *f, const char *name) {
  char line[1024];
  const char *p;
  int table[256];
  int min_code, max_code, c1, c2, i, nb, j, c;
  char name1[256], *q;
  getline(line, sizeof(line), f);
  getline(line, sizeof(line), f);
  printf("static const char *aliases_%s[] = { %s, NULL };\n\n", name, line);
  for (i = 0; i < 256; i++)
    table[i] = i;
  nb = 0;
  for (;;) {
    if (!getline(line, sizeof(line), f))
      break;
    if (!strcasecmp(line, "# compatibility"))
      break;
    if (line[0] == '\0' || line[0] == '#')
      continue;
    p = line;
    c1 = strtol(p, (char **)&p, 0);
    if (!isspace(*p))
      continue;
    c2 = strtol(p, (char **)&p, 0);
    if (c1 >= 256) {
      fprintf(stderr, "%s: ERROR %d %d\n", name, c1, c2);
      continue;
    }
    table[c1] = c2;
    nb++;
  }
  if (table[10] != 10)
    fprintf(stderr, "%s: warning: newline is not preserved\n", name);
  min_code = 0x7fffffff;
  max_code = -1;
  for (i = 0; i < 256; i++) {
    if (table[i] != i) {
      if (i < min_code)
        min_code = i;
      if (i > max_code)
        max_code = i;
    }
  }
  if (max_code != -1) {
    printf("static const unsigned short table_%s[%d] = {\n", name,
           max_code - min_code + 1);
    j = 0;
    for (i = min_code; i <= max_code; i++) {
      printf("0x%04x, ", table[i]);
      if ((j++ & 7) == 7)
        printf("\n");
    }
    if ((j & 7) != 0)
      printf("\n");
    printf("};\n\n");
  }
  q = name1;
  for (p = name; *p != '\0'; p++) {
    c = *p;
    if (c == '_')
      c = '-';
    *q++ = c;
  }
  *q = '\0';
  printf("QECharset charset_%s = {\n"
         "\"%s\",\n"
         "aliases_%s,\n"
         "decode_8bit_init,\n"
         "NULL,\n"
         "encode_8bit,\n"
         "table_alloc: 1,\n"
         "min_char: %d,\n"
         "max_char: %d,\n"
         "private_table: table_%s,\n"
         "};\n\n",
         name, name1, name, min_code, max_code, name);
}


x86 assembly (clang, -O0):
<handle_cp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x950,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1080 <getline@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1080 <getline@plt>
mov    -0x10(%rbp),%rsi
lea    -0x410(%rbp),%rdx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x834(%rbp)
cmpl   $0x100,-0x834(%rbp)
jge    11f8 <handle_cp+0x98>
mov    -0x834(%rbp),%ecx
movslq -0x834(%rbp),%rax
mov    %ecx,-0x820(%rbp,%rax,4)
mov    -0x834(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x834(%rbp)
jmp    11c0 <handle_cp+0x60>
movl   $0x0,-0x838(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1080 <getline@plt>
cmp    $0x0,%eax
jne    1225 <handle_cp+0xc5>
jmp    1331 <handle_cp+0x1d1>
lea    -0x410(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1246 <handle_cp+0xe6>
jmp    1331 <handle_cp+0x1d1>
movsbl -0x410(%rbp),%eax
cmp    $0x0,%eax
je     1266 <handle_cp+0x106>
movsbl -0x410(%rbp),%eax
cmp    $0x23,%eax
jne    126b <handle_cp+0x10b>
jmp    1202 <handle_cp+0xa2>
lea    -0x410(%rbp),%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rdi
lea    -0x418(%rbp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
mov    %eax,-0x82c(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%eax
jne    12b1 <handle_cp+0x151>
jmp    1202 <handle_cp+0xa2>
mov    -0x418(%rbp),%rdi
lea    -0x418(%rbp),%rsi
xor    %edx,%edx
call   1070 <strtol@plt>
mov    %eax,-0x830(%rbp)
cmpl   $0x100,-0x82c(%rbp)
jl     1309 <handle_cp+0x1a9>
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x82c(%rbp),%ecx
mov    -0x830(%rbp),%r8d
lea    0xd45(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1202 <handle_cp+0xa2>
mov    -0x830(%rbp),%ecx
movslq -0x82c(%rbp),%rax
mov    %ecx,-0x820(%rbp,%rax,4)
mov    -0x838(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x838(%rbp)
jmp    1202 <handle_cp+0xa2>
cmpl   $0xa,-0x7f8(%rbp)
je     1359 <handle_cp+0x1f9>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xd01(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x7fffffff,-0x824(%rbp)
ff ff 7f
movl   $0xffffffff,-0x828(%rbp)
ff ff ff
movl   $0x0,-0x834(%rbp)
cmpl   $0x100,-0x834(%rbp)
jge    13fb <handle_cp+0x29b>
movslq -0x834(%rbp),%rax
mov    -0x820(%rbp,%rax,4),%eax
cmp    -0x834(%rbp),%eax
je     13e2 <handle_cp+0x282>
mov    -0x834(%rbp),%eax
cmp    -0x824(%rbp),%eax
jge    13bf <handle_cp+0x25f>
mov    -0x834(%rbp),%eax
mov    %eax,-0x824(%rbp)
mov    -0x834(%rbp),%eax
cmp    -0x828(%rbp),%eax
jle    13dd <handle_cp+0x27d>
mov    -0x834(%rbp),%eax
mov    %eax,-0x828(%rbp)
jmp    13e2 <handle_cp+0x282>
jmp    13e7 <handle_cp+0x287>
mov    -0x834(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x834(%rbp)
jmp    1377 <handle_cp+0x217>
cmpl   $0xffffffff,-0x828(%rbp)
je     14df <handle_cp+0x37f>
mov    -0x10(%rbp),%rsi
mov    -0x828(%rbp),%edx
sub    -0x824(%rbp),%edx
add    $0x1,%edx
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x83c(%rbp)
mov    -0x824(%rbp),%eax
mov    %eax,-0x834(%rbp)
mov    -0x834(%rbp),%eax
cmp    -0x828(%rbp),%eax
jg     14b1 <handle_cp+0x351>
movslq -0x834(%rbp),%rax
mov    -0x820(%rbp,%rax,4),%esi
lea    0xc42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x83c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x83c(%rbp)
and    $0x7,%eax
cmp    $0x7,%eax
jne    1498 <handle_cp+0x338>
lea    0xcb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    149d <handle_cp+0x33d>
mov    -0x834(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x834(%rbp)
jmp    143f <handle_cp+0x2df>
mov    -0x83c(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
je     14d1 <handle_cp+0x371>
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x940(%rbp),%rax
mov    %rax,-0x948(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1568 <handle_cp+0x408>
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x840(%rbp)
cmpl   $0x5f,-0x840(%rbp)
jne    1532 <handle_cp+0x3d2>
movl   $0x2d,-0x840(%rbp)
mov    -0x840(%rbp),%eax
mov    %al,%cl
mov    -0x948(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x948(%rbp)
mov    %cl,(%rax)
mov    -0x418(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x418(%rbp)
jmp    14f8 <handle_cp+0x398>
mov    -0x948(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rsi
lea    -0x940(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x824(%rbp),%r8d
mov    -0x828(%rbp),%r9d
mov    -0x10(%rbp),%rax
lea    0xb17(%rip),%rdi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x950,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_cp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x928,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x520(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10a0 <getline@plt>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10a0 <getline@plt>
lea    0xeca(%rip),%rdi
xor    %ebp,%ebp
mov    %r15,0x8(%rsp)
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
movdqa 0xe1e(%rip),%xmm0
movdqa 0xe25(%rip),%xmm8
movdqa 0xe2c(%rip),%xmm9
movdqa 0xe33(%rip),%xmm10
movdqa 0xe3b(%rip),%xmm4
movdqa 0xe43(%rip),%xmm5
movdqa 0xe4b(%rip),%xmm6
movdqa 0xe53(%rip),%xmm7
movdqa 0xe5b(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqa %xmm0,0x20(%rsp,%rbp,4)
movdqa %xmm2,0x30(%rsp,%rbp,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqa %xmm2,0x40(%rsp,%rbp,4)
movdqa %xmm3,0x50(%rsp,%rbp,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqa %xmm2,0x60(%rsp,%rbp,4)
movdqa %xmm3,0x70(%rsp,%rbp,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqa %xmm2,0x80(%rsp,%rbp,4)
movdqa %xmm3,0x90(%rsp,%rbp,4)
add    $0x20,%rbp
paddd  %xmm1,%xmm0
cmp    $0x100,%rbp
jne    1230 <handle_cp+0xb0>
lea    0x520(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10a0 <getline@plt>
test   %eax,%eax
je     138d <handle_cp+0x20d>
lea    0xde5(%rip),%r15
lea    0x18(%rsp),%r12
jmp    1324 <handle_cp+0x1a4>
mov    0x2cf5(%rip),%rcx
mov    (%rcx),%edi
lea    0xdde(%rip),%rsi
mov    0x8(%rsp),%rdx
mov    %r13d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1080 <fprintf@plt>
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10a0 <getline@plt>
test   %eax,%eax
je     138d <handle_cp+0x20d>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     138d <handle_cp+0x20d>
movzbl 0x520(%rsp),%eax
test   %al,%al
je     1310 <handle_cp+0x190>
cmp    $0x23,%al
je     1310 <handle_cp+0x190>
mov    %rbp,0x18(%rsp)
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,%r13d
mov    0x18(%rsp),%r14
movsbl (%r14),%edi
call   1070 <isspace@plt>
test   %eax,%eax
je     1310 <handle_cp+0x190>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
cmp    $0x100,%r13d
jge    12e4 <handle_cp+0x164>
movslq %r13d,%rcx
mov    %eax,0x20(%rsp,%rcx,4)
jmp    1310 <handle_cp+0x190>
cmpl   $0xa,0x48(%rsp)
mov    0x8(%rsp),%r14
je     13b3 <handle_cp+0x233>
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
lea    0xd3a(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%ebx
mov    $0x7fffffff,%ebp
xor    %eax,%eax
jmp    13e9 <handle_cp+0x269>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x24(%rsp,%rax,4),%edi
cmp    %rdi,%rsi
cmove  %edx,%ebx
cmove  %ecx,%ebp
add    $0x2,%rax
cmp    $0x100,%rax
je     142d <handle_cp+0x2ad>
movslq %ebp,%rdx
mov    %eax,%ecx
cmp    %rdx,%rax
jl     13f5 <handle_cp+0x275>
mov    %ebp,%ecx
movslq %ebx,%rsi
mov    %eax,%edx
cmp    %rsi,%rax
jg     1401 <handle_cp+0x281>
mov    %ebx,%edx
mov    0x20(%rsp,%rax,4),%esi
cmp    %rsi,%rax
cmove  %ebx,%edx
cmove  %ebp,%ecx
lea    0x1(%rax),%rsi
movslq %ecx,%rdi
mov    %esi,%ebp
cmp    %rdi,%rsi
jl     141e <handle_cp+0x29e>
mov    %ecx,%ebp
movslq %edx,%rdi
mov    %edx,%ebx
cmp    %rdi,%rax
jl     13d0 <handle_cp+0x250>
lea    0x1(%rax),%ebx
jmp    13d0 <handle_cp+0x250>
cmp    $0xffffffff,%ebx
je     14ce <handle_cp+0x34e>
mov    %ebx,%r15d
sub    %ebp,%r15d
add    $0x1,%r15d
lea    0xcc3(%rip),%rdi
mov    %r14,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %ebp,%ebx
jl     14c2 <handle_cp+0x342>
movslq %ebp,%rax
lea    (%rsp,%rax,4),%r14
add    $0x20,%r14
mov    %r15d,0x14(%rsp)
mov    %r15d,%r13d
lea    0xcc6(%rip),%r12
xor    %r15d,%r15d
jmp    1489 <handle_cp+0x309>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %r15d,%r13d
je     14ac <handle_cp+0x32c>
mov    (%r14,%r15,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15d,%eax
not    %eax
test   $0x7,%al
jne    1480 <handle_cp+0x300>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1480 <handle_cp+0x300>
testb  $0x7,0x14(%rsp)
mov    0x8(%rsp),%r14
je     14c2 <handle_cp+0x342>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd12(%rip),%rdi
call   1050 <puts@plt>
mov    (%r14),%dl
lea    0x420(%rsp),%rax
test   %dl,%dl
je     150a <handle_cp+0x38a>
lea    0x1(%r14),%rcx
mov    $0x2d,%esi
cs nopw 0x0(%rax,%rax,1)
cmp    $0x5f,%dl
movzbl %dl,%edx
cmove  %esi,%edx
mov    %dl,(%rax)
add    $0x1,%rax
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    14f0 <handle_cp+0x370>
movb   $0x0,(%rax)
mov    %r14,(%rsp)
lea    0xc29(%rip),%rdi
lea    0x420(%rsp),%rdx
mov    %r14,%rsi
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %ebx,%r9d
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x928,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"static const char *aliases_%s[] = { %s, NULL };\0A\0A\00"
@.str.1 = [16 x i8] c"# compatibility\00"
@stderr = global i32 0
@.str.2 = [17 x i8] c"%s: ERROR %d %d\0A\00"
@.str.3 = [39 x i8] c"%s: warning: newline is not preserved\0A\00"
@.str.4 = [46 x i8] c"static const unsigned short table_%s[%d] = {\0A\00"
@.str.5 = [9 x i8] c"0x%04x, \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [5 x i8] c"};\0A\0A\00"
@.str.8 = [154 x i8] c"QECharset charset_%s = {\0A\22%s\22,\0Aaliases_%s,\0Adecode_8bit_init,\0ANULL,\0Aencode_8bit,\0Atable_alloc: 1,\0Amin_char: %d,\0Amax_char: %d,\0Aprivate_table: table_%s,\0A};\0A\0A\00"
define void @handle_cp(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = alloca i8*
%7 = alloca [256 x 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 [256 x i8]
%17 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%19 = load i32*, i32** %3
%20 = call i32 @getline(i8* %18, i32 1024, i32* %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%22 = load i32*, i32** %3
%23 = call i32 @getline(i8* %21, i32 1024, i32* %22)
%24 = load i8*, i8** %4
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %25)
store i32 0, i32* %12
br label %27
27: ; preds = %35, %2
%28 = load i32, i32* %12
%29 = icmp slt i32 %28, 256
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i32, i32* %12
%32 = load i32, i32* %12
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 %33
store i32 %31, i32* %34
br label %35
35: ; preds = %30
%36 = load i32, i32* %12
%37 = add nsw i32 %36, 1
store i32 %37, i32* %12
br label %27
38: ; preds = %27
store i32 0, i32* %13
br label %39
39: ; preds = %81, %75, %69, %60, %38
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%41 = load i32*, i32** %3
%42 = call i32 @getline(i8* %40, i32 1024, i32* %41)
%43 = icmp ne i32 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %39
br label %88
45: ; preds = %39
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%47 = call i32 @strcasecmp(i8* %46, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %50, label %49
49: ; preds = %45
br label %88
50: ; preds = %45
%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 eq i32 %53, 0
br i1 %54, label %60, label %55
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 eq i32 %58, 35
br i1 %59, label %60, label %61
60: ; preds = %55, %50
br label %39
61: ; preds = %55
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
store i8* %62, i8** %6
%63 = load i8*, i8** %6
%64 = call i32 @strtol(i8* %63, i8** %6, i32 0)
store i32 %64, i32* %10
%65 = load i8*, i8** %6
%66 = load i8, i8* %65
%67 = call i32 @isspace(i8 signext %66)
%68 = icmp ne i32 %67, 0
br i1 %68, label %70, label %69
69: ; preds = %61
br label %39
70: ; preds = %61
%71 = load i8*, i8** %6
%72 = call i32 @strtol(i8* %71, i8** %6, i32 0)
store i32 %72, i32* %11
%73 = load i32, i32* %10
%74 = icmp sge i32 %73, 256
br i1 %74, label %75, label %81
75: ; preds = %70
%76 = load i32, i32* @stderr
%77 = load i8*, i8** %4
%78 = load i32, i32* %10
%79 = load i32, i32* %11
%80 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %77, i32 %78, i32 %79)
br label %39
81: ; preds = %70
%82 = load i32, i32* %11
%83 = load i32, i32* %10
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 %84
store i32 %82, i32* %85
%86 = load i32, i32* %13
%87 = add nsw i32 %86, 1
store i32 %87, i32* %13
br label %39
88: ; preds = %49, %44
%89 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 10
%90 = load i32, i32* %89
%91 = icmp ne i32 %90, 10
br i1 %91, label %92, label %96
92: ; preds = %88
%93 = load i32, i32* @stderr
%94 = load i8*, i8** %4
%95 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %94)
br label %96
96: ; preds = %92, %88
store i32 2147483647, i32* %8
store i32 -1, i32* %9
store i32 0, i32* %12
br label %97
97: ; preds = %121, %96
%98 = load i32, i32* %12
%99 = icmp slt i32 %98, 256
br i1 %99, label %100, label %124
100: ; preds = %97
%101 = load i32, i32* %12
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 %102
%104 = load i32, i32* %103
%105 = load i32, i32* %12
%106 = icmp ne i32 %104, %105
br i1 %106, label %107, label %120
107: ; preds = %100
%108 = load i32, i32* %12
%109 = load i32, i32* %8
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %113
111: ; preds = %107
%112 = load i32, i32* %12
store i32 %112, i32* %8
br label %113
113: ; preds = %111, %107
%114 = load i32, i32* %12
%115 = load i32, i32* %9
%116 = icmp sgt i32 %114, %115
br i1 %116, label %117, label %119
117: ; preds = %113
%118 = load i32, i32* %12
store i32 %118, i32* %9
br label %119
119: ; preds = %117, %113
br label %120
120: ; preds = %119, %100
br label %121
121: ; preds = %120
%122 = load i32, i32* %12
%123 = add nsw i32 %122, 1
store i32 %123, i32* %12
br label %97
124: ; preds = %97
%125 = load i32, i32* %9
%126 = icmp ne i32 %125, -1
br i1 %126, label %127, label %163
127: ; preds = %124
%128 = load i8*, i8** %4
%129 = load i32, i32* %9
%130 = load i32, i32* %8
%131 = sub nsw i32 %129, %130
%132 = add nsw i32 %131, 1
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* %128, i32 %132)
store i32 0, i32* %14
%134 = load i32, i32* %8
store i32 %134, i32* %12
br label %135
135: ; preds = %152, %127
%136 = load i32, i32* %12
%137 = load i32, i32* %9
%138 = icmp sle i32 %136, %137
br i1 %138, label %139, label %155
139: ; preds = %135
%140 = load i32, i32* %12
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 %141
%143 = load i32, i32* %142
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %143)
%145 = load i32, i32* %14
%146 = add nsw i32 %145, 1
store i32 %146, i32* %14
%147 = and i32 %145, 7
%148 = icmp eq i32 %147, 7
br i1 %148, label %149, label %151
149: ; preds = %139
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %151
151: ; preds = %149, %139
br label %152
152: ; preds = %151
%153 = load i32, i32* %12
%154 = add nsw i32 %153, 1
store i32 %154, i32* %12
br label %135
155: ; preds = %135
%156 = load i32, i32* %14
%157 = and i32 %156, 7
%158 = icmp ne i32 %157, 0
br i1 %158, label %159, label %161
159: ; preds = %155
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %161
161: ; preds = %159, %155
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %163
163: ; preds = %161, %124
%164 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
store i8* %164, i8** %17
%165 = load i8*, i8** %4
store i8* %165, i8** %6
br label %166
166: ; preds = %183, %163
%167 = load i8*, i8** %6
%168 = load i8, i8* %167
%169 = sext i8 %168 to i32
%170 = icmp ne i32 %169, 0
br i1 %170, label %171, label %186
171: ; preds = %166
%172 = load i8*, i8** %6
%173 = load i8, i8* %172
%174 = sext i8 %173 to i32
store i32 %174, i32* %15
%175 = load i32, i32* %15
%176 = icmp eq i32 %175, 95
br i1 %176, label %177, label %178
177: ; preds = %171
store i32 45, i32* %15
br label %178
178: ; preds = %177, %171
%179 = load i32, i32* %15
%180 = trunc i32 %179 to i8
%181 = load i8*, i8** %17
%182 = getelementptr inbounds i8, i8* %181, i32 1
store i8* %182, i8** %17
store i8 %180, i8* %181
br label %183
183: ; preds = %178
%184 = load i8*, i8** %6
%185 = getelementptr inbounds i8, i8* %184, i32 1
store i8* %185, i8** %6
br label %166
186: ; preds = %166
%187 = load i8*, i8** %17
store i8 0, i8* %187
%188 = load i8*, i8** %4
%189 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%190 = load i8*, i8** %4
%191 = load i32, i32* %8
%192 = load i32, i32* %9
%193 = load i8*, i8** %4
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.8, i64 0, i64 0), i8* %188, i8* %189, i8* %190, i32 %191, i32 %192, i8* %193)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"static const char *aliases_%s[] = { %s, NULL };\0A\0A\00"
@.str.1 = [16 x i8] c"# compatibility\00"
@stderr = global i32 0
@.str.2 = [17 x i8] c"%s: ERROR %d %d\0A\00"
@.str.3 = [39 x i8] c"%s: warning: newline is not preserved\0A\00"
@.str.4 = [46 x i8] c"static const unsigned short table_%s[%d] = {\0A\00"
@.str.5 = [9 x i8] c"0x%04x, \00"
@.str.8 = [154 x i8] c"QECharset charset_%s = {\0A\22%s\22,\0Aaliases_%s,\0Adecode_8bit_init,\0ANULL,\0Aencode_8bit,\0Atable_alloc: 1,\0Amin_char: %d,\0Amax_char: %d,\0Aprivate_table: table_%s,\0A};\0A\0A\00"
@str = [4 x i8] c"};\0A\00"
define void @handle_cp(i32* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = alloca i8*
%5 = alloca [256 x i32]
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = bitcast i8** %4 to i8*
%9 = bitcast [256 x i32]* %5 to i8*
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%11 = call i32 @getline(i8* %7, i32 1024, i32* %0)
%12 = call i32 @getline(i8* %7, i32 1024, i32* %0)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %7)
br label %14
14: ; preds = %14, %2
%15 = phi i64 [ 0, %2 ], [ %43, %14 ]
%16 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %2 ], [ %44, %14 ]
%17 = add <4 x i32> %16, <i32 4, i32 4, i32 4, i32 4>
%18 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %15
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %16, <4 x i32>* %19
%20 = getelementptr inbounds i32, i32* %18, i64 4
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %21
%22 = or i64 %15, 8
%23 = add <4 x i32> %16, <i32 8, i32 8, i32 8, i32 8>
%24 = add <4 x i32> %16, <i32 12, i32 12, i32 12, i32 12>
%25 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %22
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %26
%27 = getelementptr inbounds i32, i32* %25, i64 4
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> %24, <4 x i32>* %28
%29 = or i64 %15, 16
%30 = add <4 x i32> %16, <i32 16, i32 16, i32 16, i32 16>
%31 = add <4 x i32> %16, <i32 20, i32 20, i32 20, i32 20>
%32 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %29
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> %30, <4 x i32>* %33
%34 = getelementptr inbounds i32, i32* %32, i64 4
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> %31, <4 x i32>* %35
%36 = or i64 %15, 24
%37 = add <4 x i32> %16, <i32 24, i32 24, i32 24, i32 24>
%38 = add <4 x i32> %16, <i32 28, i32 28, i32 28, i32 28>
%39 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %36
%40 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> %37, <4 x i32>* %40
%41 = getelementptr inbounds i32, i32* %39, i64 4
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> %38, <4 x i32>* %42
%43 = add nuw nsw i64 %15, 32
%44 = add <4 x i32> %16, <i32 32, i32 32, i32 32, i32 32>
%45 = icmp eq i64 %43, 256
br i1 %45, label %46, label %14
46: ; preds = %14
%47 = call i32 @getline(i8* %7, i32 1024, i32* %0)
%48 = icmp eq i32 %47, 0
br i1 %48, label %75, label %49
49: ; preds = %46, %69
%50 = call i32 @strcasecmp(i8* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%51 = icmp eq i32 %50, 0
br i1 %51, label %75, label %52
52: ; preds = %49
%53 = load i8, i8* %7
switch i8 %53, label %54 [
i8 35, label %66
i8 0, label %66
]
54: ; preds = %52
store i8* %7, i8** %4
%55 = call i32 @strtol(i8* %7, i8** %4, i32 0)
%56 = load i8*, i8** %4
%57 = load i8, i8* %56
%58 = call i32 @isspace(i8 signext %57)
%59 = icmp eq i32 %58, 0
br i1 %59, label %66, label %60
60: ; preds = %54
%61 = call i32 @strtol(i8* %56, i8** %4, i32 0)
%62 = icmp sgt i32 %55, 255
br i1 %62, label %63, label %70
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %1, i32 %55, i32 %61)
br label %66
66: ; preds = %63, %54, %52, %52
%67 = call i32 @getline(i8* %7, i32 1024, i32* %0)
%68 = icmp eq i32 %67, 0
br i1 %68, label %75, label %69
69: ; preds = %66, %70
br label %49
70: ; preds = %60
%71 = sext i32 %55 to i64
%72 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %71
store i32 %61, i32* %72
%73 = call i32 @getline(i8* %7, i32 1024, i32* %0)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %69
75: ; preds = %70, %66, %49, %46
%76 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 10
%77 = load i32, i32* %76
%78 = icmp eq i32 %77, 10
br i1 %78, label %82, label %79
79: ; preds = %75
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %82
82: ; preds = %79, %75
br label %83
83: ; preds = %83, %82
%84 = phi i64 [ 0, %82 ], [ %114, %83 ]
%85 = phi i32 [ 2147483647, %82 ], [ %113, %83 ]
%86 = phi i32 [ -1, %82 ], [ %112, %83 ]
%87 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %84
%88 = load i32, i32* %87
%89 = zext i32 %88 to i64
%90 = icmp eq i64 %84, %89
%91 = sext i32 %85 to i64
%92 = icmp slt i64 %84, %91
%93 = trunc i64 %84 to i32
%94 = select i1 %92, i32 %93, i32 %85
%95 = sext i32 %86 to i64
%96 = icmp sgt i64 %84, %95
%97 = select i1 %96, i32 %93, i32 %86
%98 = select i1 %90, i32 %86, i32 %97
%99 = select i1 %90, i32 %85, i32 %94
%100 = or i64 %84, 1
%101 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %100
%102 = load i32, i32* %101
%103 = zext i32 %102 to i64
%104 = icmp eq i64 %100, %103
%105 = sext i32 %99 to i64
%106 = icmp slt i64 %100, %105
%107 = trunc i64 %100 to i32
%108 = select i1 %106, i32 %107, i32 %99
%109 = sext i32 %98 to i64
%110 = icmp slt i64 %84, %109
%111 = select i1 %104, i1 true, i1 %110
%112 = select i1 %111, i32 %98, i32 %107
%113 = select i1 %104, i32 %99, i32 %108
%114 = add nuw nsw i64 %84, 2
%115 = icmp eq i64 %114, 256
br i1 %115, label %116, label %83
116: ; preds = %83
%117 = icmp eq i32 %112, -1
br i1 %117, label %146, label %118
118: ; preds = %116
%119 = add nuw i32 %112, 1
%120 = sub i32 %119, %113
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* %1, i32 %120)
%122 = icmp sgt i32 %113, %112
br i1 %122, label %144, label %123
123: ; preds = %118
%124 = sext i32 %113 to i64
br label %125
125: ; preds = %123, %136
%126 = phi i64 [ %124, %123 ], [ %137, %136 ]
%127 = phi i32 [ 0, %123 ], [ %131, %136 ]
%128 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 %126
%129 = load i32, i32* %128
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %129)
%131 = add nuw i32 %127, 1
%132 = and i32 %127, 7
%133 = icmp eq i32 %132, 7
br i1 %133, label %134, label %136
134: ; preds = %125
%135 = call i32 @putchar(i32 10)
br label %136
136: ; preds = %125, %134
%137 = add nsw i64 %126, 1
%138 = icmp eq i32 %131, %120
br i1 %138, label %139, label %125
139: ; preds = %136
%140 = and i32 %120, 7
%141 = icmp eq i32 %140, 0
br i1 %141, label %144, label %142
142: ; preds = %139
%143 = call i32 @putchar(i32 10)
br label %144
144: ; preds = %118, %142, %139
%145 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %146
146: ; preds = %144, %116
%147 = load i8, i8* %1
%148 = icmp eq i8 %147, 0
br i1 %148, label %159, label %149
149: ; preds = %146, %149
%150 = phi i8 [ %157, %149 ], [ %147, %146 ]
%151 = phi i8* [ %155, %149 ], [ %10, %146 ]
%152 = phi i8* [ %156, %149 ], [ %1, %146 ]
%153 = icmp eq i8 %150, 95
%154 = select i1 %153, i8 45, i8 %150
%155 = getelementptr inbounds i8, i8* %151, i64 1
store i8 %154, i8* %151
%156 = getelementptr inbounds i8, i8* %152, i64 1
%157 = load i8, i8* %156
%158 = icmp eq i8 %157, 0
br i1 %158, label %159, label %149
159: ; preds = %149, %146
%160 = phi i8* [ %10, %146 ], [ %155, %149 ]
store i8 0, i8* %160
%161 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([154 x i8], [154 x i8]* @.str.8, i64 0, i64 0), i8* %1, i8* %10, i8* %1, i32 %113, i32 %112, i8* %1)
ret void
}