#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;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
main() {
  int i;
  char koitab[128], wintab[128];
  char buf[4096];
  int koi, win;
  for (i = 0; i < 128; i++)
    koitab[i] = wintab[i] = 0;
  while (fgets(buf, sizeof(buf), stdin) != NULL) {
    if (*buf == '#')
      continue;
    sscanf(buf, "%d %d", &koi, &win);
    if (koi < 128 || koi > 255 || win < 128 || win > 255) {
      fprintf(stderr, "invalid value %d\n", koi);
      exit(1);
    }
    koitab[koi - 128] = win;
    wintab[win - 128] = koi;
  }
  i = 0;
  printf("static char koi2win[] = {\n");
  while (i < 128) {
    int j = 0;
    while (j < 8) {
      printf("0x%02x", koitab[i++]);
      j++;
      if (i >= 128)
        break;
      printf(", ");
    }
    printf("\n");
  }
  printf("};\n");
  i = 0;
  printf("static char win2koi[] = {\n");
  while (i < 128) {
    int j = 0;
    while (j < 8) {
      printf("0x%02x", wintab[i++]);
      j++;
      if (i >= 128)
        break;
      printf(", ");
    }
    printf("\n");
  }
  printf("};\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jge    119c <main+0x4c>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
movslq -0x8(%rbp),%rax
movb   $0x0,-0x90(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <main+0x19>
jmp    11a1 <main+0x51>
lea    -0x1110(%rbp),%rdi
mov    0x2e39(%rip),%rax
mov    (%rax),%edx
mov    $0x1000,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     129d <main+0x14d>
movsbl -0x1110(%rbp),%eax
cmp    $0x23,%eax
jne    11da <main+0x8a>
jmp    11a1 <main+0x51>
lea    -0x1110(%rbp),%rdi
lea    0xe18(%rip),%rsi
lea    -0x1114(%rbp),%rdx
lea    -0x1118(%rbp),%rcx
call   1060 <sscanf@plt>
cmpl   $0x80,-0x1114(%rbp)
jl     123b <main+0xeb>
cmpl   $0xff,-0x1114(%rbp)
jg     123b <main+0xeb>
cmpl   $0x80,-0x1118(%rbp)
jl     123b <main+0xeb>
cmpl   $0xff,-0x1118(%rbp)
jle    1260 <main+0x110>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
mov    -0x1114(%rbp),%edx
lea    0xdb5(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x1118(%rbp),%eax
mov    %al,%cl
mov    -0x1114(%rbp),%eax
sub    $0x80,%eax
cltq
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0x1114(%rbp),%eax
mov    %al,%cl
mov    -0x1118(%rbp),%eax
sub    $0x80,%eax
cltq
mov    %cl,-0x110(%rbp,%rax,1)
jmp    11a1 <main+0x51>
movl   $0x0,-0x8(%rbp)
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x80,-0x8(%rbp)
jge    1340 <main+0x1f0>
movl   $0x0,-0x111c(%rbp)
cmpl   $0x8,-0x111c(%rbp)
jge    132d <main+0x1dd>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movsbl -0x90(%rbp,%rax,1),%esi
ff
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x111c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x111c(%rbp)
cmpl   $0x80,-0x8(%rbp)
jl     131a <main+0x1ca>
jmp    132d <main+0x1dd>
lea    0xd19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c9 <main+0x179>
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b2 <main+0x162>
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x80,-0x8(%rbp)
jge    13f1 <main+0x2a1>
movl   $0x0,-0x1120(%rbp)
cmpl   $0x8,-0x1120(%rbp)
jge    13de <main+0x28e>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movsbl -0x110(%rbp,%rax,1),%esi
ff
lea    0xc90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1120(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1120(%rbp)
cmpl   $0x80,-0x8(%rbp)
jl     13cb <main+0x27b>
jmp    13de <main+0x28e>
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    137a <main+0x22a>
lea    0xc5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1363 <main+0x213>
lea    0xc45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1110,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0x100(%rsp)
mov    0x2df3(%rip),%r13
mov    0x0(%r13),%edx
lea    0x110(%rsp),%rdi
mov    $0x1000,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     12a1 <main+0x131>
lea    0x110(%rsp),%rbx
lea    0xddd(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
jmp    1246 <main+0xd6>
nop
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     12a1 <main+0x131>
cmpb   $0x23,0x110(%rsp)
23
je     1230 <main+0xc0>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1080 <sscanf@plt>
mov    0xc(%rsp),%edx
lea    -0x100(%rdx),%eax
cmp    $0xffffff80,%eax
jb     15ce <main+0x45e>
mov    0x8(%rsp),%eax
cmp    $0x80,%eax
jl     15ce <main+0x45e>
cmp    $0x100,%eax
jge    15ce <main+0x45e>
lea    -0x80(%rdx),%ecx
mov    %al,0x90(%rsp,%rcx,1)
add    $0xffffff80,%eax
mov    %dl,0x10(%rsp,%rax,1)
jmp    1230 <main+0xc0>
lea    0xd7a(%rip),%rdi
call   1040 <puts@plt>
lea    0xd64(%rip),%r15
lea    0xd64(%rip),%r14
xor    %ebx,%ebx
cmp    $0x7f,%ebx
mov    $0x7f,%r12d
cmovg  %ebx,%r12d
movsbl 0x90(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r12d
je     1424 <main+0x2b4>
lea    -0x1(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x91(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     1424 <main+0x2b4>
lea    -0x2(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x92(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     1424 <main+0x2b4>
lea    -0x3(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x93(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     1424 <main+0x2b4>
lea    -0x4(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x94(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     1424 <main+0x2b4>
lea    -0x5(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x95(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     1424 <main+0x2b4>
lea    -0x6(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x96(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     1424 <main+0x2b4>
add    $0xfffffffffffffff9,%r12
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x97(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r12d
je     1424 <main+0x2b4>
add    $0x8,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x80,%ebx
jl     12bd <main+0x14d>
jmp    142e <main+0x2be>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc21(%rip),%rdi
call   1040 <puts@plt>
lea    0xbfb(%rip),%rdi
call   1040 <puts@plt>
lea    0xbcb(%rip),%r15
lea    0xbcb(%rip),%r14
xor    %ebx,%ebx
cmp    $0x7f,%ebx
mov    $0x7f,%r12d
cmovg  %ebx,%r12d
movsbl 0x10(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r12d
je     15a5 <main+0x435>
lea    -0x1(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x11(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     15a5 <main+0x435>
lea    -0x2(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x12(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     15a5 <main+0x435>
lea    -0x3(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x13(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     15a5 <main+0x435>
lea    -0x4(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x14(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     15a5 <main+0x435>
lea    -0x5(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x15(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     15a5 <main+0x435>
lea    -0x6(%r12),%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x16(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r13d
je     15a5 <main+0x435>
add    $0xfffffffffffffff9,%r12
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x17(%rsp,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r12d
je     15a5 <main+0x435>
add    $0x8,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x80,%ebx
jl     1456 <main+0x2e6>
jmp    15af <main+0x43f>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xaa0(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x1110,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2a03(%rip),%rax
mov    (%rax),%edi
lea    0xa28(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [6 x i8] c"%d %d\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"invalid value %d\0A\00"
@.str.2 = [27 x i8] c"static char koi2win[] = {\0A\00"
@.str.3 = [7 x i8] c"0x%02x\00"
@.str.4 = [3 x i8] c", \00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [4 x i8] c"};\0A\00"
@.str.7 = [27 x i8] c"static char win2koi[] = {\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca [4096 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 128
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %15
store i8 0, i8* %16
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %18
store i8 0, i8* %19
br label %20
20: ; preds = %13
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %10
23: ; preds = %10
br label %24
24: ; preds = %54, %34, %23
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%26 = load i32, i32* @stdin
%27 = call i32* @fgets(i8* %25, i32 4096, i32 %26)
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %67
29: ; preds = %24
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 35
br i1 %33, label %34, label %35
34: ; preds = %29
br label %24
35: ; preds = %29
%36 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%37 = call i32 @sscanf(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7)
%38 = load i32, i32* %6
%39 = icmp slt i32 %38, 128
br i1 %39, label %49, label %40
40: ; preds = %35
%41 = load i32, i32* %6
%42 = icmp sgt i32 %41, 255
br i1 %42, label %49, label %43
43: ; preds = %40
%44 = load i32, i32* %7
%45 = icmp slt i32 %44, 128
br i1 %45, label %49, label %46
46: ; preds = %43
%47 = load i32, i32* %7
%48 = icmp sgt i32 %47, 255
br i1 %48, label %49, label %54
49: ; preds = %46, %43, %40, %35
%50 = load i32, i32* @stderr
%51 = load i32, i32* %6
%52 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %46
%55 = load i32, i32* %7
%56 = trunc i32 %55 to i8
%57 = load i32, i32* %6
%58 = sub nsw i32 %57, 128
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %59
store i8 %56, i8* %60
%61 = load i32, i32* %6
%62 = trunc i32 %61 to i8
%63 = load i32, i32* %7
%64 = sub nsw i32 %63, 128
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %65
store i8 %62, i8* %66
br label %24
67: ; preds = %24
store i32 0, i32* %2
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %69
69: ; preds = %91, %67
%70 = load i32, i32* %2
%71 = icmp slt i32 %70, 128
br i1 %71, label %72, label %93
72: ; preds = %69
store i32 0, i32* %8
br label %73
73: ; preds = %89, %72
%74 = load i32, i32* %8
%75 = icmp slt i32 %74, 8
br i1 %75, label %76, label %91
76: ; preds = %73
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
store i32 %78, i32* %2
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %82)
%84 = load i32, i32* %8
%85 = add nsw i32 %84, 1
store i32 %85, i32* %8
%86 = load i32, i32* %2
%87 = icmp sge i32 %86, 128
br i1 %87, label %88, label %89
88: ; preds = %76
br label %91
89: ; preds = %76
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %73
91: ; preds = %88, %73
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %69
93: ; preds = %69
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %2
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %96
96: ; preds = %118, %93
%97 = load i32, i32* %2
%98 = icmp slt i32 %97, 128
br i1 %98, label %99, label %120
99: ; preds = %96
store i32 0, i32* %9
br label %100
100: ; preds = %116, %99
%101 = load i32, i32* %9
%102 = icmp slt i32 %101, 8
br i1 %102, label %103, label %118
103: ; preds = %100
%104 = load i32, i32* %2
%105 = add nsw i32 %104, 1
store i32 %105, i32* %2
%106 = sext i32 %104 to i64
%107 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %109)
%111 = load i32, i32* %9
%112 = add nsw i32 %111, 1
store i32 %112, i32* %9
%113 = load i32, i32* %2
%114 = icmp sge i32 %113, 128
br i1 %114, label %115, label %116
115: ; preds = %103
br label %118
116: ; preds = %103
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %100
118: ; preds = %115, %100
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %96
120: ; preds = %96
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%122 = load i32, i32* %1
ret i32 %122
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [6 x i8] c"%d %d\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"invalid value %d\0A\00"
@.str.3 = [7 x i8] c"0x%02x\00"
@.str.4 = [3 x i8] c", \00"
@str = [26 x i8] c"static char koi2win[] = {\00"
@str.9 = [26 x i8] c"static char win2koi[] = {\00"
@str.10 = [3 x i8] c"};\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = alloca [4096 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = load i32, i32* @stdin
%14 = call i32* @fgets(i8* %10, i32 4096, i32 %13)
%15 = icmp eq i32* %14, null
br i1 %15, label %46, label %16
16: ; preds = %0, %42
%17 = load i8, i8* %10
%18 = icmp eq i8 %17, 35
br i1 %18, label %42, label %19
19: ; preds = %16
%20 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7)
%21 = load i32, i32* %6
%22 = add i32 %21, -256
%23 = icmp ult i32 %22, -128
%24 = load i32, i32* %7
%25 = icmp slt i32 %24, 128
%26 = select i1 %23, i1 true, i1 %25
%27 = icmp sgt i32 %24, 255
%28 = select i1 %26, i1 true, i1 %27
br i1 %28, label %29, label %33
29: ; preds = %19
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %19
%34 = trunc i32 %24 to i8
%35 = add nsw i32 %21, -128
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %36
store i8 %34, i8* %37
%38 = trunc i32 %21 to i8
%39 = add nsw i32 %24, -128
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %40
store i8 %38, i8* %41
br label %42
42: ; preds = %33, %16
%43 = load i32, i32* @stdin
%44 = call i32* @fgets(i8* %10, i32 4096, i32 %43)
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %16
46: ; preds = %42, %0
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %48
48: ; preds = %46, %116
%49 = phi i32 [ 0, %46 ], [ %117, %116 ]
%50 = sext i32 %49 to i64
%51 = call i32 @llvm.smax.i32(i32 %49, i32 127)
%52 = sub i32 %51, %49
%53 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %50
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = icmp eq i32 %52, 0
br i1 %57, label %114, label %58
58: ; preds = %48
%59 = or i64 %50, 1
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%61 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %59
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = icmp eq i32 %52, 1
br i1 %65, label %114, label %66
66: ; preds = %58
%67 = or i64 %50, 2
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%69 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %67
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %71)
%73 = icmp eq i32 %52, 2
br i1 %73, label %114, label %74
74: ; preds = %66
%75 = or i64 %50, 3
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%77 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %75
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %79)
%81 = icmp eq i32 %52, 3
br i1 %81, label %114, label %82
82: ; preds = %74
%83 = or i64 %50, 4
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%85 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %83
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %87)
%89 = icmp eq i32 %52, 4
br i1 %89, label %114, label %90
90: ; preds = %82
%91 = or i64 %50, 5
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%93 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %91
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %95)
%97 = icmp eq i32 %52, 5
br i1 %97, label %114, label %98
98: ; preds = %90
%99 = or i64 %50, 6
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%101 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %99
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %103)
%105 = icmp eq i32 %52, 6
br i1 %105, label %114, label %106
106: ; preds = %98
%107 = or i64 %50, 7
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%109 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %107
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %111)
%113 = icmp eq i32 %52, 7
br i1 %113, label %114, label %116
114: ; preds = %48, %58, %66, %74, %82, %90, %98, %106
%115 = call i32 @putchar(i32 10)
br label %121
116: ; preds = %106
%117 = add i32 %49, 8
%118 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%119 = call i32 @putchar(i32 10)
%120 = icmp slt i32 %117, 128
br i1 %120, label %48, label %121
121: ; preds = %116, %114
%122 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0))
%123 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0))
br label %124
124: ; preds = %121, %192
%125 = phi i32 [ 0, %121 ], [ %193, %192 ]
%126 = sext i32 %125 to i64
%127 = call i32 @llvm.smax.i32(i32 %125, i32 127)
%128 = sub i32 %127, %125
%129 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %126
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %131)
%133 = icmp eq i32 %128, 0
br i1 %133, label %190, label %134
134: ; preds = %124
%135 = or i64 %126, 1
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%137 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %135
%138 = load i8, i8* %137
%139 = sext i8 %138 to i32
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %139)
%141 = icmp eq i32 %128, 1
br i1 %141, label %190, label %142
142: ; preds = %134
%143 = or i64 %126, 2
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%145 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %143
%146 = load i8, i8* %145
%147 = sext i8 %146 to i32
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %147)
%149 = icmp eq i32 %128, 2
br i1 %149, label %190, label %150
150: ; preds = %142
%151 = or i64 %126, 3
%152 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%153 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %151
%154 = load i8, i8* %153
%155 = sext i8 %154 to i32
%156 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %155)
%157 = icmp eq i32 %128, 3
br i1 %157, label %190, label %158
158: ; preds = %150
%159 = or i64 %126, 4
%160 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%161 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %159
%162 = load i8, i8* %161
%163 = sext i8 %162 to i32
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %163)
%165 = icmp eq i32 %128, 4
br i1 %165, label %190, label %166
166: ; preds = %158
%167 = or i64 %126, 5
%168 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%169 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %167
%170 = load i8, i8* %169
%171 = sext i8 %170 to i32
%172 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %171)
%173 = icmp eq i32 %128, 5
br i1 %173, label %190, label %174
174: ; preds = %166
%175 = or i64 %126, 6
%176 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%177 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %175
%178 = load i8, i8* %177
%179 = sext i8 %178 to i32
%180 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %179)
%181 = icmp eq i32 %128, 6
br i1 %181, label %190, label %182
182: ; preds = %174
%183 = or i64 %126, 7
%184 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%185 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %183
%186 = load i8, i8* %185
%187 = sext i8 %186 to i32
%188 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %187)
%189 = icmp eq i32 %128, 7
br i1 %189, label %190, label %192
190: ; preds = %124, %134, %142, %150, %158, %166, %174, %182
%191 = call i32 @putchar(i32 10)
br label %197
192: ; preds = %182
%193 = add i32 %125, 8
%194 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%195 = call i32 @putchar(i32 10)
%196 = icmp slt i32 %193, 128
br i1 %196, label %124, label %197
197: ; preds = %192, %190
%198 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}