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

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, ...);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ han2zen(int /*<<< orphan*/ *, int *, int *, int);
void shift2shift(FILE *in, FILE *out, int incode, int tofullsize) {
  int p1, p2;
  while ((p1 = getc(in)) != EOF) {
    switch (p1) {
    case 13:
    case 10:
      fprintf(out, "%c", 10);
      break;
    case 0:
    case 12:
      break;
    default:
      if (((p1 >= 129) && (p1 <= 159)) || ((p1 >= 224) && (p1 <= 239))) {
        p2 = getc(in);
        if ((p2 >= 64) && (p2 <= 252))
          fprintf(out, "%c%c", p1, p2);
      } else if (((p1 >= 161) && (p1 <= 223)) && (tofullsize)) {
        han2zen(in, &p1, &p2, incode);
        fprintf(out, "%c%c", p1, p2);
      } else
        fprintf(out, "%c", p1);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<shift2shift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%eax
je     1294 <shift2shift+0x164>
mov    -0x1c(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0xd,%rax
ja     11a7 <shift2shift+0x77>
mov    -0x28(%rbp),%rax
lea    0xe83(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0xa,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    128f <shift2shift+0x15f>
jmp    128f <shift2shift+0x15f>
cmpl   $0x81,-0x1c(%rbp)
jl     11c1 <shift2shift+0x91>
cmpl   $0x9f,-0x1c(%rbp)
jle    11db <shift2shift+0xab>
cmpl   $0xe0,-0x1c(%rbp)
jl     121b <shift2shift+0xeb>
cmpl   $0xef,-0x1c(%rbp)
jg     121b <shift2shift+0xeb>
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x40,-0x20(%rbp)
jl     1216 <shift2shift+0xe6>
cmpl   $0xfc,-0x20(%rbp)
jg     1216 <shift2shift+0xe6>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    128a <shift2shift+0x15a>
cmpl   $0xa1,-0x1c(%rbp)
jl     1270 <shift2shift+0x140>
cmpl   $0xdf,-0x1c(%rbp)
jg     1270 <shift2shift+0x140>
cmpl   $0x0,-0x18(%rbp)
je     1270 <shift2shift+0x140>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <han2zen@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1285 <shift2shift+0x155>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xdbc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    128a <shift2shift+0x15a>
jmp    128f <shift2shift+0x15f>
jmp    1146 <shift2shift+0x16>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift2shift>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1060 <getc@plt>
mov    %eax,(%rsp)
mov    0x2e82(%rip),%r13
cmp    0x0(%r13),%eax
jne    117b <shift2shift+0x3b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7e(%rip),%r12
jmp    11ae <shift2shift+0x6e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
mov    %rbx,%rdi
call   1060 <getc@plt>
mov    %eax,(%rsp)
cmp    0x0(%r13),%eax
je     116c <shift2shift+0x2c>
cmp    $0xd,%eax
ja     11be <shift2shift+0x7e>
mov    %eax,%ecx
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
lea    -0x81(%rax),%ecx
cmp    $0x1f,%ecx
jb     120c <shift2shift+0xcc>
mov    %eax,%ecx
and    $0xfffffff0,%ecx
cmp    $0xe0,%ecx
je     120c <shift2shift+0xcc>
test   %r15d,%r15d
je     1242 <shift2shift+0x102>
lea    -0xa1(%rax),%ecx
cmp    $0x3e,%ecx
ja     1242 <shift2shift+0x102>
mov    %rbx,%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
mov    %r14d,%ecx
call   1050 <han2zen@plt>
mov    (%rsp),%edx
mov    0x4(%rsp),%ecx
mov    %rbp,%rdi
lea    0xe2e(%rip),%rsi
jmp    1236 <shift2shift+0xf6>
mov    %rbx,%rdi
call   1060 <getc@plt>
mov    %eax,0x4(%rsp)
lea    -0x40(%rax),%ecx
cmp    $0xbc,%ecx
ja     119d <shift2shift+0x5d>
mov    (%rsp),%edx
mov    %rbp,%rdi
lea    0xe04(%rip),%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    119d <shift2shift+0x5d>
mov    %eax,%edi
jmp    1195 <shift2shift+0x55>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [5 x i8] c"%c%c\00"
define void @shift2shift(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
br label %11
11: ; preds = %71, %4
%12 = load i32*, i32** %5
%13 = call i32 @getc(i32* %12)
store i32 %13, i32* %9
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %72
16: ; preds = %11
%17 = load i32, i32* %9
switch i32 %17, label %22 [
i32 13, label %18
i32 10, label %18
i32 0, label %21
i32 12, label %21
]
18: ; preds = %16, %16
%19 = load i32*, i32** %6
%20 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 10)
br label %71
21: ; preds = %16, %16
br label %71
22: ; preds = %16
%23 = load i32, i32* %9
%24 = icmp sge i32 %23, 129
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %9
%27 = icmp sle i32 %26, 159
br i1 %27, label %34, label %28
28: ; preds = %25, %22
%29 = load i32, i32* %9
%30 = icmp sge i32 %29, 224
br i1 %30, label %31, label %48
31: ; preds = %28
%32 = load i32, i32* %9
%33 = icmp sle i32 %32, 239
br i1 %33, label %34, label %48
34: ; preds = %31, %25
%35 = load i32*, i32** %5
%36 = call i32 @getc(i32* %35)
store i32 %36, i32* %10
%37 = load i32, i32* %10
%38 = icmp sge i32 %37, 64
br i1 %38, label %39, label %47
39: ; preds = %34
%40 = load i32, i32* %10
%41 = icmp sle i32 %40, 252
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i32*, i32** %6
%44 = load i32, i32* %9
%45 = load i32, i32* %10
%46 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %44, i32 %45)
br label %47
47: ; preds = %42, %39, %34
br label %70
48: ; preds = %31, %28
%49 = load i32, i32* %9
%50 = icmp sge i32 %49, 161
br i1 %50, label %51, label %65
51: ; preds = %48
%52 = load i32, i32* %9
%53 = icmp sle i32 %52, 223
br i1 %53, label %54, label %65
54: ; preds = %51
%55 = load i32, i32* %8
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %65
57: ; preds = %54
%58 = load i32*, i32** %5
%59 = load i32, i32* %7
%60 = call i32 @han2zen(i32* %58, i32* %9, i32* %10, i32 %59)
%61 = load i32*, i32** %6
%62 = load i32, i32* %9
%63 = load i32, i32* %10
%64 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %62, i32 %63)
br label %69
65: ; preds = %54, %51, %48
%66 = load i32*, i32** %6
%67 = load i32, i32* %9
%68 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %65, %57
br label %70
70: ; preds = %69, %47
br label %71
71: ; preds = %70, %21, %18
br label %11
72: ; preds = %11
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@.str.1 = [5 x i8] c"%c%c\00"
define void @shift2shift(i32* %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %5 to i8*
%8 = bitcast i32* %6 to i8*
%9 = call i32 @getc(i32* %0)
store i32 %9, i32* %5
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %46, label %12
12: ; preds = %4
%13 = icmp ne i32 %3, 0
br label %14
14: ; preds = %12, %42
%15 = phi i32 [ %9, %12 ], [ %43, %42 ]
switch i32 %15, label %18 [
i32 13, label %16
i32 10, label %16
i32 0, label %42
i32 12, label %42
]
16: ; preds = %14, %14
%17 = call i32 @fputc(i32 10, i32* %1)
br label %42
18: ; preds = %14
%19 = add i32 %15, -129
%20 = icmp ult i32 %19, 31
%21 = and i32 %15, -16
%22 = icmp eq i32 %21, 224
%23 = or i1 %20, %22
br i1 %23, label %24, label %31
24: ; preds = %18
%25 = call i32 @getc(i32* %0)
store i32 %25, i32* %6
%26 = add i32 %25, -64
%27 = icmp ult i32 %26, 189
br i1 %27, label %28, label %42
28: ; preds = %24
%29 = load i32, i32* %5
%30 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %25)
br label %42
31: ; preds = %18
%32 = add i32 %15, -161
%33 = icmp ult i32 %32, 63
%34 = and i1 %13, %33
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = call i32 @han2zen(i32* %0, i32* %5, i32* %6, i32 %2)
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38)
br label %42
40: ; preds = %31
%41 = call i32 @fputc(i32 %15, i32* %1)
br label %42
42: ; preds = %28, %24, %40, %35, %14, %14, %16
%43 = call i32 @getc(i32* %0)
store i32 %43, i32* %5
%44 = load i32, i32* @EOF
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %14
46: ; preds = %42, %4
ret void
}