#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 getc(int /*<<< orphan*/ *);
int cp1251_getc(FILE *fin) {
  static const unsigned short cp1251_to_unicode[256] = {
      0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,   0x08,
      0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,   0x10,   0x11,
      0x12,   0x13,   0x14,   0x15,   0x16,   0x17,   0x18,   0x19,   0x1a,
      0x1b,   0x1c,   0x1d,   0x1e,   0x1f,   0x20,   0x21,   0x22,   0x23,
      0x24,   0x25,   0x26,   0x27,   0x28,   0x29,   0x2a,   0x2b,   0x2c,
      0x2d,   0x2e,   0x2f,   0x30,   0x31,   0x32,   0x33,   0x34,   0x35,
      0x36,   0x37,   0x38,   0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,
      0x3f,   0x40,   0x41,   0x42,   0x43,   0x44,   0x45,   0x46,   0x47,
      0x48,   0x49,   0x4a,   0x4b,   0x4c,   0x4d,   0x4e,   0x4f,   0x50,
      0x51,   0x52,   0x53,   0x54,   0x55,   0x56,   0x57,   0x58,   0x59,
      0x5a,   0x5b,   0x5c,   0x5d,   0x5e,   0x5f,   0x60,   0x61,   0x62,
      0x63,   0x64,   0x65,   0x66,   0x67,   0x68,   0x69,   0x6a,   0x6b,
      0x6c,   0x6d,   0x6e,   0x6f,   0x70,   0x71,   0x72,   0x73,   0x74,
      0x75,   0x76,   0x77,   0x78,   0x79,   0x7a,   0x7b,   0x7c,   0x7d,
      0x7e,   0x7f,   0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020,
      0x2021, 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f,
      0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x98,
      0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, 0xa0,   0x040e,
      0x045e, 0x0408, 0xa4,   0x0490, 0xa6,   0xa7,   0x0401, 0xa9,   0x0404,
      0xab,   0xac,   0xad,   0xae,   0x0407, 0xb0,   0xb1,   0x0406, 0x0456,
      0x0491, 0xb5,   0xb6,   0xb7,   0x0451, 0x2116, 0x0454, 0xbb,   0x0458,
      0x0405, 0x0455, 0x0457, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415,
      0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e,
      0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
      0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430,
      0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439,
      0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442,
      0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b,
      0x044c, 0x044d, 0x044e, 0x044f,
  };
  int c;
  c = getc(fin);
  if (c < 0)
    return c;
  return cp1251_to_unicode[c];
}


x86 assembly (clang, -O0):
<cp1251_getc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    113d <cp1251_getc+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <cp1251_getc+0x3f>
movslq -0x14(%rbp),%rcx
lea    0xeb8(%rip),%rax
movzwl (%rax,%rcx,2),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cp1251_getc>:
push   %rax
call   1030 <getc@plt>
test   %eax,%eax
js     1127 <cp1251_getc+0x17>
mov    %eax,%eax
lea    0xedd(%rip),%rcx
movzwl (%rcx,%rax,2),%eax
pop    %rcx
ret

LLVM IR (-O0):
@cp1251_getc.cp1251_to_unicode = internal constant [256 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 24, i16 25, i16 26, i16 27, i16 28, i16 29, i16 30, i16 31, i16 32, i16 33, i16 34, i16 35, i16 36, i16 37, i16 38, i16 39, i16 40, i16 41, i16 42, i16 43, i16 44, i16 45, i16 46, i16 47, i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 58, i16 59, i16 60, i16 61, i16 62, i16 63, i16 64, i16 65, i16 66, i16 67, i16 68, i16 69, i16 70, i16 71, i16 72, i16 73, i16 74, i16 75, i16 76, i16 77, i16 78, i16 79, i16 80, i16 81, i16 82, i16 83, i16 84, i16 85, i16 86, i16 87, i16 88, i16 89, i16 90, i16 91, i16 92, i16 93, i16 94, i16 95, i16 96, i16 97, i16 98, i16 99, i16 100, i16 101, i16 102, i16 103, i16 104, i16 105, i16 106, i16 107, i16 108, i16 109, i16 110, i16 111, i16 112, i16 113, i16 114, i16 115, i16 116, i16 117, i16 118, i16 119, i16 120, i16 121, i16 122, i16 123, i16 124, i16 125, i16 126, i16 127, i16 1026, i16 1027, i16 8218, i16 1107, i16 8222, i16 8230, i16 8224, i16 8225, i16 8364, i16 8240, i16 1033, i16 8249, i16 1034, i16 1036, i16 1035, i16 1039, i16 1106, i16 8216, i16 8217, i16 8220, i16 8221, i16 8226, i16 8211, i16 8212, i16 152, i16 8482, i16 1113, i16 8250, i16 1114, i16 1116, i16 1115, i16 1119, i16 160, i16 1038, i16 1118, i16 1032, i16 164, i16 1168, i16 166, i16 167, i16 1025, i16 169, i16 1028, i16 171, i16 172, i16 173, i16 174, i16 1031, i16 176, i16 177, i16 1030, i16 1110, i16 1169, i16 181, i16 182, i16 183, i16 1105, i16 8470, i16 1108, i16 187, i16 1112, i16 1029, i16 1109, i16 1111, i16 1040, i16 1041, i16 1042, i16 1043, i16 1044, i16 1045, i16 1046, i16 1047, i16 1048, i16 1049, i16 1050, i16 1051, i16 1052, i16 1053, i16 1054, i16 1055, i16 1056, i16 1057, i16 1058, i16 1059, i16 1060, i16 1061, i16 1062, i16 1063, i16 1064, i16 1065, i16 1066, i16 1067, i16 1068, i16 1069, i16 1070, i16 1071, i16 1072, i16 1073, i16 1074, i16 1075, i16 1076, i16 1077, i16 1078, i16 1079, i16 1080, i16 1081, i16 1082, i16 1083, i16 1084, i16 1085, i16 1086, i16 1087, i16 1088, i16 1089, i16 1090, i16 1091, i16 1092, i16 1093, i16 1094, i16 1095, i16 1096, i16 1097, i16 1098, i16 1099, i16 1100, i16 1101, i16 1102, i16 1103]
define i32 @cp1251_getc(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @getc(i32* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %17
11: ; preds = %1
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [256 x i16], [256 x i16]* @cp1251_getc.cp1251_to_unicode, i64 0, i64 %13
%15 = load i16, i16* %14
%16 = zext i16 %15 to i32
store i32 %16, i32* %2
br label %17
17: ; preds = %11, %9
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@cp1251_getc.cp1251_to_unicode = internal unnamed_addr constant [256 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 24, i16 25, i16 26, i16 27, i16 28, i16 29, i16 30, i16 31, i16 32, i16 33, i16 34, i16 35, i16 36, i16 37, i16 38, i16 39, i16 40, i16 41, i16 42, i16 43, i16 44, i16 45, i16 46, i16 47, i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 58, i16 59, i16 60, i16 61, i16 62, i16 63, i16 64, i16 65, i16 66, i16 67, i16 68, i16 69, i16 70, i16 71, i16 72, i16 73, i16 74, i16 75, i16 76, i16 77, i16 78, i16 79, i16 80, i16 81, i16 82, i16 83, i16 84, i16 85, i16 86, i16 87, i16 88, i16 89, i16 90, i16 91, i16 92, i16 93, i16 94, i16 95, i16 96, i16 97, i16 98, i16 99, i16 100, i16 101, i16 102, i16 103, i16 104, i16 105, i16 106, i16 107, i16 108, i16 109, i16 110, i16 111, i16 112, i16 113, i16 114, i16 115, i16 116, i16 117, i16 118, i16 119, i16 120, i16 121, i16 122, i16 123, i16 124, i16 125, i16 126, i16 127, i16 1026, i16 1027, i16 8218, i16 1107, i16 8222, i16 8230, i16 8224, i16 8225, i16 8364, i16 8240, i16 1033, i16 8249, i16 1034, i16 1036, i16 1035, i16 1039, i16 1106, i16 8216, i16 8217, i16 8220, i16 8221, i16 8226, i16 8211, i16 8212, i16 152, i16 8482, i16 1113, i16 8250, i16 1114, i16 1116, i16 1115, i16 1119, i16 160, i16 1038, i16 1118, i16 1032, i16 164, i16 1168, i16 166, i16 167, i16 1025, i16 169, i16 1028, i16 171, i16 172, i16 173, i16 174, i16 1031, i16 176, i16 177, i16 1030, i16 1110, i16 1169, i16 181, i16 182, i16 183, i16 1105, i16 8470, i16 1108, i16 187, i16 1112, i16 1029, i16 1109, i16 1111, i16 1040, i16 1041, i16 1042, i16 1043, i16 1044, i16 1045, i16 1046, i16 1047, i16 1048, i16 1049, i16 1050, i16 1051, i16 1052, i16 1053, i16 1054, i16 1055, i16 1056, i16 1057, i16 1058, i16 1059, i16 1060, i16 1061, i16 1062, i16 1063, i16 1064, i16 1065, i16 1066, i16 1067, i16 1068, i16 1069, i16 1070, i16 1071, i16 1072, i16 1073, i16 1074, i16 1075, i16 1076, i16 1077, i16 1078, i16 1079, i16 1080, i16 1081, i16 1082, i16 1083, i16 1084, i16 1085, i16 1086, i16 1087, i16 1088, i16 1089, i16 1090, i16 1091, i16 1092, i16 1093, i16 1094, i16 1095, i16 1096, i16 1097, i16 1098, i16 1099, i16 1100, i16 1101, i16 1102, i16 1103]
define i32 @cp1251_getc(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds [256 x i16], [256 x i16]* @cp1251_getc.cp1251_to_unicode, i64 0, i64 %5
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ %2, %1 ]
ret i32 %10
}