#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 */

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  char buffer[BUFSIZ];
  char *p;
  while (fgets(buffer, BUFSIZ, stdin) != NULL) {
    for (p = buffer; *p != 0; p++) {
      if (strncmp(p, "charset=utf-8", 13) == 0 ||
          strncmp(p, "charset=UTF-8", 13) == 0) {
        fputs("charset=cp932", stdout);
        p += 12;
      } else if (strncmp(p, "# Original translations", 23) == 0) {
        fputs("# generated from ja.po, DO NOT EDIT", stdout);
        while (p[1] != '\n')
          ++p;
      } else if (*(unsigned char *)p == 0x81 && p[1] == '_') {
        putchar('\\');
        ++p;
      } else {
        if (*p & 0x80) {
          putchar(*p++);
          if (*p == '\\')
            putchar(*p);
        }
        putchar(*p);
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
mov    0x2e52(%rip),%rax
mov    (%rax),%edx
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     133a <main+0x1fa>
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1335 <main+0x1f5>
mov    -0x28(%rbp),%rdi
lea    0xe36(%rip),%rsi
mov    $0xd,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     11fd <main+0xbd>
mov    -0x28(%rbp),%rdi
lea    0xe25(%rip),%rsi
mov    $0xd,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1223 <main+0xe3>
mov    0x2dcc(%rip),%rax
mov    (%rax),%esi
lea    0xe0f(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x28(%rbp),%rax
add    $0xc,%rax
mov    %rax,-0x28(%rbp)
jmp    131f <main+0x1df>
mov    -0x28(%rbp),%rdi
lea    0xdfc(%rip),%rsi
mov    $0x17,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    127e <main+0x13e>
mov    0x2d87(%rip),%rax
mov    (%rax),%esi
lea    0xdf0(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0xa,%eax
je     1279 <main+0x139>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1257 <main+0x117>
jmp    131a <main+0x1da>
mov    -0x28(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x81,%eax
jne    12bc <main+0x17c>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5f,%eax
jne    12bc <main+0x17c>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1315 <main+0x1d5>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1309 <main+0x1c9>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1304 <main+0x1c4>
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    1309 <main+0x1c9>
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    131a <main+0x1da>
jmp    131f <main+0x1df>
jmp    1324 <main+0x1e4>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11af <main+0x6f>
jmp    1182 <main+0x42>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x2e76(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1060 <fgets@plt>
test   %rax,%rax
je     12cd <main+0x18d>
lea    0xe74(%rip),%r12
mov    0x2e3d(%rip),%r13
mov    %rbx,-0x30(%rbp)
jmp    11c7 <main+0x87>
nopl   0x0(%rax)
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
mov    -0x30(%rbp),%rbx
mov    %rbx,%rdi
call   1060 <fgets@plt>
test   %rax,%rax
je     12cd <main+0x18d>
cmpb   $0x0,(%rbx)
lea    0xe4b(%rip),%rbx
je     11a0 <main+0x60>
mov    -0x30(%rbp),%r15
jmp    11fb <main+0xbb>
test   %al,%al
js     12a3 <main+0x163>
mov    %r15,%r14
movsbl %al,%edi
call   1030 <putchar@plt>
nopl   0x0(%rax)
lea    0x1(%r14),%r15
cmpb   $0x0,0x1(%r14)
je     11a0 <main+0x60>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0xd,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1260 <main+0x120>
mov    %r15,%rdi
lea    0xdf4(%rip),%rsi
mov    $0xd,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1260 <main+0x120>
mov    %r15,%rdi
lea    0xdf7(%rip),%rsi
mov    $0x17,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1278 <main+0x138>
mov    (%r15),%al
cmp    $0x81,%al
jne    11d9 <main+0x99>
cmpb   $0x5f,0x1(%r15)
jne    12a3 <main+0x163>
add    $0x1,%r15
mov    $0x5c,%edi
call   1030 <putchar@plt>
jmp    1270 <main+0x130>
mov    0x0(%r13),%esi
mov    %rbx,%rdi
call   1050 <fputs@plt>
add    $0xc,%r15
mov    %r15,%r14
jmp    11f0 <main+0xb0>
mov    0x0(%r13),%esi
lea    0xdbf(%rip),%rdi
call   1050 <fputs@plt>
add    $0xffffffffffffffff,%r15
nopl   0x0(%rax)
lea    0x1(%r15),%r14
cmpb   $0xa,0x2(%r15)
mov    %r14,%r15
jne    1290 <main+0x150>
jmp    11f0 <main+0xb0>
lea    0x1(%r15),%r14
movsbl %al,%edi
call   1030 <putchar@plt>
mov    0x1(%r15),%al
cmp    $0x5c,%al
jne    11e4 <main+0xa4>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    (%r14),%al
jmp    11e4 <main+0xa4>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@stdin = global i32 0
@.str = [14 x i8] c"charset=utf-8\00"
@.str.1 = [14 x i8] c"charset=UTF-8\00"
@.str.2 = [14 x i8] c"charset=cp932\00"
@stdout = global i32 0
@.str.3 = [24 x i8] c"# Original translations\00"
@.str.4 = [36 x i8] c"# generated from ja.po, DO NOT EDIT\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @BUFSIZ
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %6
%12 = alloca i8, i64 %10
store i64 %10, i64* %7
br label %13
13: ; preds = %99, %2
%14 = load i32, i32* @BUFSIZ
%15 = load i32, i32* @stdin
%16 = call i32* @fgets(i8* %12, i32 %14, i32 %15)
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %100
18: ; preds = %13
store i8* %12, i8** %8
br label %19
19: ; preds = %96, %18
%20 = load i8*, i8** %8
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %99
24: ; preds = %19
%25 = load i8*, i8** %8
%26 = call i64 @strncmp(i8* %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%27 = icmp eq i64 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i8*, i8** %8
%30 = call i64 @strncmp(i8* %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 13)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %28, %24
%33 = load i32, i32* @stdout
%34 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = load i8*, i8** %8
%36 = getelementptr inbounds i8, i8* %35, i64 12
store i8* %36, i8** %8
br label %95
37: ; preds = %28
%38 = load i8*, i8** %8
%39 = call i64 @strncmp(i8* %38, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 23)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %54
41: ; preds = %37
%42 = load i32, i32* @stdout
%43 = call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %50, %41
%45 = load i8*, i8** %8
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 10
br i1 %49, label %50, label %53
50: ; preds = %44
%51 = load i8*, i8** %8
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %8
br label %44
53: ; preds = %44
br label %94
54: ; preds = %37
%55 = load i8*, i8** %8
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = icmp eq i32 %57, 129
br i1 %58, label %59, label %69
59: ; preds = %54
%60 = load i8*, i8** %8
%61 = getelementptr inbounds i8, i8* %60, i64 1
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 95
br i1 %64, label %65, label %69
65: ; preds = %59
%66 = call i32 @putchar(i8 signext 92)
%67 = load i8*, i8** %8
%68 = getelementptr inbounds i8, i8* %67, i32 1
store i8* %68, i8** %8
br label %93
69: ; preds = %59, %54
%70 = load i8*, i8** %8
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = and i32 %72, 128
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %89
75: ; preds = %69
%76 = load i8*, i8** %8
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %8
%78 = load i8, i8* %76
%79 = call i32 @putchar(i8 signext %78)
%80 = load i8*, i8** %8
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 92
br i1 %83, label %84, label %88
84: ; preds = %75
%85 = load i8*, i8** %8
%86 = load i8, i8* %85
%87 = call i32 @putchar(i8 signext %86)
br label %88
88: ; preds = %84, %75
br label %89
89: ; preds = %88, %69
%90 = load i8*, i8** %8
%91 = load i8, i8* %90
%92 = call i32 @putchar(i8 signext %91)
br label %93
93: ; preds = %89, %65
br label %94
94: ; preds = %93, %53
br label %95
95: ; preds = %94, %32
br label %96
96: ; preds = %95
%97 = load i8*, i8** %8
%98 = getelementptr inbounds i8, i8* %97, i32 1
store i8* %98, i8** %8
br label %19
99: ; preds = %19
br label %13
100: ; preds = %13
%101 = load i8*, i8** %6
%102 = load i32, i32* %3
ret i32 %102
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@stdin = global i32 0
@.str = [14 x i8] c"charset=utf-8\00"
@.str.1 = [14 x i8] c"charset=UTF-8\00"
@.str.2 = [14 x i8] c"charset=cp932\00"
@stdout = global i32 0
@.str.3 = [24 x i8] c"# Original translations\00"
@.str.4 = [36 x i8] c"# generated from ja.po, DO NOT EDIT\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @BUFSIZ
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %5, i32 %3, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %67, label %14
9: ; preds = %62, %14
%10 = load i32, i32* @BUFSIZ
%11 = load i32, i32* @stdin
%12 = call i32* @fgets(i8* %5, i32 %10, i32 %11)
%13 = icmp eq i32* %12, null
br i1 %13, label %67, label %14
14: ; preds = %2, %9
%15 = load i8, i8* %5
%16 = icmp eq i8 %15, 0
br i1 %16, label %9, label %17
17: ; preds = %14, %62
%18 = phi i8* [ %64, %62 ], [ %5, %14 ]
%19 = call i64 @strncmp(i8* %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = call i64 @strncmp(i8* %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 13)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21, %17
%25 = load i32, i32* @stdout
%26 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds i8, i8* %18, i64 12
br label %62
28: ; preds = %21
%29 = call i64 @strncmp(i8* %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 23)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i32, i32* @stdout
%33 = call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %34, %31
%35 = phi i8* [ %18, %31 ], [ %36, %34 ]
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 10
br i1 %38, label %62, label %34
39: ; preds = %28
%40 = load i8, i8* %18
%41 = icmp eq i8 %40, -127
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = getelementptr inbounds i8, i8* %18, i64 1
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 95
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = call i32 @putchar(i8 signext 92)
br label %62
48: ; preds = %39
%49 = icmp sgt i8 %40, -1
br i1 %49, label %58, label %50
50: ; preds = %42, %48
%51 = getelementptr inbounds i8, i8* %18, i64 1
%52 = call i32 @putchar(i8 signext %40)
%53 = load i8, i8* %51
%54 = icmp eq i8 %53, 92
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = call i32 @putchar(i8 signext 92)
%57 = load i8, i8* %51
br label %58
58: ; preds = %50, %55, %48
%59 = phi i8 [ %57, %55 ], [ %53, %50 ], [ %40, %48 ]
%60 = phi i8* [ %51, %55 ], [ %51, %50 ], [ %18, %48 ]
%61 = call i32 @putchar(i8 signext %59)
br label %62
62: ; preds = %34, %24, %46, %58
%63 = phi i8* [ %27, %24 ], [ %43, %46 ], [ %60, %58 ], [ %35, %34 ]
%64 = getelementptr inbounds i8, i8* %63, i64 1
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 0
br i1 %66, label %9, label %17
67: ; preds = %9, %2
ret i32 0
}