#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned char,
                           int /*<<< orphan*/);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ maxpalin(char *);
unsigned char strlen(char *);
int main() {
  FILE *f = fopen("CAU3.INP", "r");
  char s[256];
  fscanf(f, "%s\n", s);
  fclose(f);
  unsigned char i, count[128] = {};
  for (i = 0; i < strlen(s); count[s[i++]]++)
    ;
  for (i = 1; i < 128; i++)
    if (count[i])
      (*count)++;
  f = fopen("CAU3.OUT", "w");
  fprintf(f, "%hhd\n%hhd\n", *count, maxpalin(s));
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe79(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    0xe60(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
movb   $0x0,-0x111(%rbp)
movzbl -0x111(%rbp),%eax
mov    %eax,-0x1a4(%rbp)
lea    -0x110(%rbp),%rdi
call   1040 <strlen@plt>
mov    %al,%cl
mov    -0x1a4(%rbp),%eax
movzbl %cl,%ecx
cmp    %ecx,%eax
jge    1237 <main+0xc7>
jmp    1204 <main+0x94>
mov    -0x111(%rbp),%al
mov    %al,%cl
add    $0x1,%cl
mov    %cl,-0x111(%rbp)
movzbl %al,%eax
movsbq -0x110(%rbp,%rax,1),%rax
ff ff
mov    -0x1a0(%rbp,%rax,1),%cl
add    $0x1,%cl
mov    %cl,-0x1a0(%rbp,%rax,1)
jmp    11d3 <main+0x63>
movb   $0x1,-0x111(%rbp)
movzbl -0x111(%rbp),%eax
cmp    $0x80,%eax
jge    128b <main+0x11b>
movzbl -0x111(%rbp),%eax
cmpb   $0x0,-0x1a0(%rbp,%rax,1)
je     1273 <main+0x103>
mov    -0x1a0(%rbp),%al
add    $0x1,%al
mov    %al,-0x1a0(%rbp)
jmp    1278 <main+0x108>
mov    -0x111(%rbp),%al
add    $0x1,%al
mov    %al,-0x111(%rbp)
jmp    123e <main+0xce>
lea    0xd7d(%rip),%rdi
lea    0xd7f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
mov    -0x1a0(%rbp),%al
mov    %al,-0x1a5(%rbp)
lea    -0x110(%rbp),%rdi
call   1070 <maxpalin@plt>
mov    -0x1b0(%rbp),%rdi
mov    %eax,%ecx
mov    -0x1a5(%rbp),%al
lea    0xd3f(%rip),%rsi
movzbl %al,%edx
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x180,%rsp
lea    0xe9e(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe93(%rip),%rsi
lea    0x80(%rsp),%r14
mov    %rax,%rdi
mov    %r14,%rdx
call   1050 <fscanf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %al,%al
je     1216 <main+0xb6>
xor    %ebp,%ebp
lea    0x80(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbq 0x80(%rsp,%rbp,1),%rax
add    $0x1,%rbp
addb   $0x1,(%rsp,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
movzbl %al,%eax
cmp    %rax,%rbp
jb     11f0 <main+0x90>
mov    (%rsp),%al
jmp    1218 <main+0xb8>
xor    %eax,%eax
movzbl %al,%eax
movd   %eax,%xmm0
movdqu 0x1(%rsp),%xmm1
movdqu 0x11(%rsp),%xmm2
movdqu 0x21(%rsp),%xmm3
movdqu 0x31(%rsp),%xmm4
pxor   %xmm5,%xmm5
pcmpeqb %xmm5,%xmm1
paddb  %xmm0,%xmm1
pcmpeqb %xmm5,%xmm2
pcmpeqb %xmm5,%xmm3
paddb  %xmm2,%xmm3
paddb  %xmm1,%xmm3
pcmpeqb %xmm5,%xmm4
movdqu 0x41(%rsp),%xmm0
pcmpeqb %xmm5,%xmm0
paddb  %xmm4,%xmm0
movdqu 0x51(%rsp),%xmm1
pcmpeqb %xmm5,%xmm1
paddb  %xmm0,%xmm1
paddb  %xmm3,%xmm1
movdqu 0x61(%rsp),%xmm0
pcmpeqb %xmm5,%xmm0
paddb  %xmm1,%xmm0
paddb  0xd73(%rip),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddb  %xmm0,%xmm1
psadbw %xmm5,%xmm1
punpcklbw %xmm5,%xmm1
punpcklwd %xmm5,%xmm1
punpckldq %xmm5,%xmm1
movq   0x71(%rsp),%xmm0
pcmpeqb %xmm5,%xmm0
paddb  %xmm1,%xmm0
pcmpeqd %xmm1,%xmm1
psubb  %xmm1,%xmm0
psadbw %xmm5,%xmm0
movd   %xmm0,%ebp
cmpb   $0x1,0x79(%rsp)
sbb    $0xff,%bpl
cmpb   $0x1,0x7a(%rsp)
sbb    $0xff,%bpl
cmpb   $0x1,0x7b(%rsp)
sbb    $0xff,%bpl
cmpb   $0x1,0x7c(%rsp)
sbb    $0xff,%bpl
cmpb   $0x1,0x7d(%rsp)
sbb    $0xff,%bpl
cmpb   $0x1,0x7e(%rsp)
sbb    $0xff,%bpl
cmpb   $0x1,0x7f(%rsp)
sbb    $0xff,%bpl
lea    0xd15(%rip),%rdi
lea    0xd17(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0x80(%rsp),%rdi
call   1060 <maxpalin@plt>
movzbl %bpl,%edx
lea    0xcf9(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%ecx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x180,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"CAU3.INP\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [9 x i8] c"CAU3.OUT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [11 x i8] c"%hhd\0A%hhd\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [256 x i8]
%4 = alloca i8
%5 = alloca [128 x i8]
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = load i32*, i32** %2
%11 = call i32 @fclose(i32* %10)
%12 = bitcast [128 x i8]* %5 to i8*
store i8 0, i8* %4
br label %13
13: ; preds = %21, %0
%14 = load i8, i8* %4
%15 = zext i8 %14 to i32
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%17 = call zeroext i8 @strlen(i8* %16)
%18 = zext i8 %17 to i32
%19 = icmp slt i32 %15, %18
br i1 %19, label %20, label %31
20: ; preds = %13
br label %21
21: ; preds = %20
%22 = load i8, i8* %4
%23 = add i8 %22, 1
store i8 %23, i8* %4
%24 = zext i8 %22 to i64
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i64
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = add i8 %29, 1
store i8 %30, i8* %28
br label %13
31: ; preds = %13
store i8 1, i8* %4
br label %32
32: ; preds = %47, %31
%33 = load i8, i8* %4
%34 = zext i8 %33 to i32
%35 = icmp slt i32 %34, 128
br i1 %35, label %36, label %50
36: ; preds = %32
%37 = load i8, i8* %4
%38 = zext i8 %37 to i64
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = icmp ne i8 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%44 = load i8, i8* %43
%45 = add i8 %44, 1
store i8 %45, i8* %43
br label %46
46: ; preds = %42, %36
br label %47
47: ; preds = %46
%48 = load i8, i8* %4
%49 = add i8 %48, 1
store i8 %49, i8* %4
br label %32
50: ; preds = %32
%51 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %51, i32** %2
%52 = load i32*, i32** %2
%53 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%54 = load i8, i8* %53
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%56 = call i32 @maxpalin(i8* %55)
%57 = call i32 @fprintf(i32* %52, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %54, i32 %56)
%58 = load i32*, i32** %2
%59 = call i32 @fclose(i32* %58)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"CAU3.INP\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [9 x i8] c"CAU3.OUT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [11 x i8] c"%hhd\0A%hhd\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [128 x i8]
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%6 = call i32 @fclose(i32* %3)
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%8 = call zeroext i8 @strlen(i8* %4)
%9 = icmp eq i8 %8, 0
br i1 %9, label %24, label %12
10: ; preds = %12
%11 = load i8, i8* %7
br label %24
12: ; preds = %0, %12
%13 = phi i64 [ %14, %12 ], [ 0, %0 ]
%14 = add nuw nsw i64 %13, 1
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %13
%16 = load i8, i8* %15
%17 = sext i8 %16 to i64
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = add i8 %19, 1
store i8 %20, i8* %18
%21 = call zeroext i8 @strlen(i8* %4)
%22 = zext i8 %21 to i64
%23 = icmp ult i64 %14, %22
br i1 %23, label %12, label %10
24: ; preds = %0, %10
%25 = phi i8 [ %11, %10 ], [ 0, %0 ]
%26 = insertelement <16 x i8> <i8 poison, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %25, i64 0
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 1
%28 = bitcast i8* %27 to <16 x i8>*
%29 = load <16 x i8>, <16 x i8>* %28
%30 = icmp ne <16 x i8> %29, zeroinitializer
%31 = zext <16 x i1> %30 to <16 x i8>
%32 = add <16 x i8> %26, %31
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 17
%34 = bitcast i8* %33 to <16 x i8>*
%35 = load <16 x i8>, <16 x i8>* %34
%36 = icmp ne <16 x i8> %35, zeroinitializer
%37 = zext <16 x i1> %36 to <16 x i8>
%38 = add <16 x i8> %32, %37
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 33
%40 = bitcast i8* %39 to <16 x i8>*
%41 = load <16 x i8>, <16 x i8>* %40
%42 = icmp ne <16 x i8> %41, zeroinitializer
%43 = zext <16 x i1> %42 to <16 x i8>
%44 = add <16 x i8> %38, %43
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 49
%46 = bitcast i8* %45 to <16 x i8>*
%47 = load <16 x i8>, <16 x i8>* %46
%48 = icmp ne <16 x i8> %47, zeroinitializer
%49 = zext <16 x i1> %48 to <16 x i8>
%50 = add <16 x i8> %44, %49
%51 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 65
%52 = bitcast i8* %51 to <16 x i8>*
%53 = load <16 x i8>, <16 x i8>* %52
%54 = icmp ne <16 x i8> %53, zeroinitializer
%55 = zext <16 x i1> %54 to <16 x i8>
%56 = add <16 x i8> %50, %55
%57 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 81
%58 = bitcast i8* %57 to <16 x i8>*
%59 = load <16 x i8>, <16 x i8>* %58
%60 = icmp ne <16 x i8> %59, zeroinitializer
%61 = zext <16 x i1> %60 to <16 x i8>
%62 = add <16 x i8> %56, %61
%63 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 97
%64 = bitcast i8* %63 to <16 x i8>*
%65 = load <16 x i8>, <16 x i8>* %64
%66 = icmp ne <16 x i8> %65, zeroinitializer
%67 = zext <16 x i1> %66 to <16 x i8>
%68 = add <16 x i8> %62, %67
%69 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %68)
%70 = insertelement <8 x i8> <i8 poison, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %69, i64 0
%71 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 113
%72 = bitcast i8* %71 to <8 x i8>*
%73 = load <8 x i8>, <8 x i8>* %72
%74 = icmp ne <8 x i8> %73, zeroinitializer
%75 = zext <8 x i1> %74 to <8 x i8>
%76 = add <8 x i8> %70, %75
%77 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %76)
%78 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 121
%79 = load i8, i8* %78
%80 = icmp ne i8 %79, 0
%81 = zext i1 %80 to i8
%82 = add i8 %77, %81
%83 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 122
%84 = load i8, i8* %83
%85 = icmp ne i8 %84, 0
%86 = zext i1 %85 to i8
%87 = add i8 %82, %86
%88 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 123
%89 = load i8, i8* %88
%90 = icmp ne i8 %89, 0
%91 = zext i1 %90 to i8
%92 = add i8 %87, %91
%93 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 124
%94 = load i8, i8* %93
%95 = icmp ne i8 %94, 0
%96 = zext i1 %95 to i8
%97 = add i8 %92, %96
%98 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 125
%99 = load i8, i8* %98
%100 = icmp ne i8 %99, 0
%101 = zext i1 %100 to i8
%102 = add i8 %97, %101
%103 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 126
%104 = load i8, i8* %103
%105 = icmp ne i8 %104, 0
%106 = zext i1 %105 to i8
%107 = add i8 %102, %106
%108 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 127
%109 = load i8, i8* %108
%110 = icmp ne i8 %109, 0
%111 = zext i1 %110 to i8
%112 = add i8 %107, %111
%113 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%114 = call i32 @maxpalin(i8* %4)
%115 = call i32 @fprintf(i32* %113, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %112, i32 %114)
%116 = call i32 @fclose(i32* %113)
ret i32 0
}