#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 atoi(char *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
char *strstr(char *, char *);
int main(int argv) {
  char buffer[20000];
  int i;
  char c;
  char *cc;
  int letter_ya;
  FILE *fp;
  if (argv >= 2) {
    printf("This is filtr for munin plugin \"plugin_balderdash_mud.sh\" by "
           "prool\nProol: http://prool.kharkov.org http://mud.kharkov.org "
           "proolix <dog> gmail <dot> com\nExit: control D TWICE!!!\n");
    return 2;
  }
  letter_ya = 0;
  for (i = 0; i < 20000; i++)
    buffer[i] = 0;
  i = 0;
  while (1) {
    c = getchar();
    if (c == -1) {
      if (letter_ya == 1)
        break;
      else
        letter_ya = 1;
    } else
      letter_ya = 0;
    buffer[i++] = c;
    if (i >= (20000 - 1))
      break;
  }
  cc = strstr(buffer, "Âñåãî");
  if (cc)
    i = atoi(cc + 49);
  else
    i = 0;
  printf("c7i.value %i.0\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1179 <main+0x39>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    12ad <main+0x16d>
movl   $0x0,-0x4e44(%rbp)
movl   $0x0,-0x4e34(%rbp)
cmpl   $0x4e20,-0x4e34(%rbp)
jge    11c0 <main+0x80>
movslq -0x4e34(%rbp),%rax
movb   $0x0,-0x4e30(%rbp,%rax,1)
mov    -0x4e34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e34(%rbp)
jmp    118d <main+0x4d>
movl   $0x0,-0x4e34(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x4e35(%rbp)
movsbl -0x4e35(%rbp),%eax
cmp    $0xffffffff,%eax
jne    1208 <main+0xc8>
cmpl   $0x1,-0x4e44(%rbp)
jne    11f9 <main+0xb9>
jmp    124c <main+0x10c>
movl   $0x1,-0x4e44(%rbp)
jmp    1212 <main+0xd2>
movl   $0x0,-0x4e44(%rbp)
mov    -0x4e35(%rbp),%cl
mov    -0x4e34(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x4e34(%rbp)
cltq
mov    %cl,-0x4e30(%rbp,%rax,1)
cmpl   $0x4e1f,-0x4e34(%rbp)
jl     1247 <main+0x107>
jmp    124c <main+0x10c>
jmp    11ca <main+0x8a>
lea    -0x4e30(%rbp),%rdi
lea    0xe58(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x4e40(%rbp)
cmpq   $0x0,-0x4e40(%rbp)
je     128f <main+0x14f>
mov    -0x4e40(%rbp),%rdi
add    $0x31,%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4e34(%rbp)
jmp    1299 <main+0x159>
movl   $0x0,-0x4e34(%rbp)
mov    -0x4e34(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x4e50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x4e28,%rsp
cmp    $0x1,%edi
jle    1184 <main+0x24>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%ebx
jmp    1203 <main+0xa3>
mov    %rsp,%rdi
mov    $0x4e20,%edx
xor    %esi,%esi
call   1050 <memset@plt>
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11b2 <main+0x52>
nopl   0x0(%rax)
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %ecx,%ebp
cmp    $0x4e1f,%rbx
je     11cc <main+0x6c>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    $0x0,%ecx
cmp    $0xff,%al
jne    11a0 <main+0x40>
mov    $0x1,%ecx
cmp    $0x1,%ebp
jne    11a0 <main+0x40>
lea    0xe2d(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strstr@plt>
xor    %ebx,%ebx
mov    $0x0,%esi
test   %rax,%rax
je     11f5 <main+0x95>
add    $0x31,%rax
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,%esi
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x4e28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [178 x i8] c"This is filtr for munin plugin \22plugin_balderdash_mud.sh\22 by prool\0AProol: http://prool.kharkov.org http://mud.kharkov.org proolix <dog> gmail <dot> com\0AExit: control D TWICE!!!\0A\00"
@.str.1 = [11 x i8] c"\C3\82\C3\B1\C3\A5\C3\A3\C3\AE\00"
@.str.2 = [16 x i8] c"c7i.value %i.0\0A\00"
define i32 @main(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [20000 x i8]
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %2
store i32 %0, i32* %3
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %2
br label %61
14: ; preds = %1
store i32 0, i32* %8
store i32 0, i32* %5
br label %15
15: ; preds = %22, %14
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 20000
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [20000 x i8], [20000 x i8]* %4, i64 0, i64 %20
store i8 0, i8* %21
br label %22
22: ; preds = %18
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %15
25: ; preds = %15
store i32 0, i32* %5
br label %26
26: ; preds = %25, %47
%27 = call signext i8 (...) @getchar()
store i8 %27, i8* %6
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %35
34: ; preds = %31
br label %48
35: ; preds = %31
store i32 1, i32* %8
br label %36
36: ; preds = %35
br label %38
37: ; preds = %26
store i32 0, i32* %8
br label %38
38: ; preds = %37, %36
%39 = load i8, i8* %6
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds [20000 x i8], [20000 x i8]* %4, i64 0, i64 %42
store i8 %39, i8* %43
%44 = load i32, i32* %5
%45 = icmp sge i32 %44, 19999
br i1 %45, label %46, label %47
46: ; preds = %38
br label %48
47: ; preds = %38
br label %26
48: ; preds = %46, %34
%49 = getelementptr inbounds [20000 x i8], [20000 x i8]* %4, i64 0, i64 0
%50 = call i8* @strstr(i8* %49, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i8* %50, i8** %7
%51 = load i8*, i8** %7
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = load i8*, i8** %7
%55 = getelementptr inbounds i8, i8* %54, i64 49
%56 = call i32 @atoi(i8* %55)
store i32 %56, i32* %5
br label %58
57: ; preds = %48
store i32 0, i32* %5
br label %58
58: ; preds = %57, %53
%59 = load i32, i32* %5
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %58, %12
%62 = load i32, i32* %2
ret i32 %62
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"\C3\82\C3\B1\C3\A5\C3\A3\C3\AE\00"
@.str.2 = [16 x i8] c"c7i.value %i.0\0A\00"
@str = [177 x i8] c"This is filtr for munin plugin \22plugin_balderdash_mud.sh\22 by prool\0AProol: http://prool.kharkov.org http://mud.kharkov.org proolix <dog> gmail <dot> com\0AExit: control D TWICE!!!\00"
define i32 @main(i32 %0) {
%2 = alloca [20000 x i8]
%3 = getelementptr inbounds [20000 x i8], [20000 x i8]* %2, i64 0, i64 0
%4 = icmp sgt i32 %0, 1
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = getelementptr inbounds [20000 x i8], [20000 x i8]* %2, i64 0, i64 0
br label %9
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([177 x i8], [177 x i8]* @str, i64 0, i64 0))
br label %30
9: ; preds = %5, %16
%10 = phi i64 [ 0, %5 ], [ %18, %16 ]
%11 = phi i32 [ 0, %5 ], [ %17, %16 ]
%12 = tail call signext i8 (...) @getchar()
%13 = icmp eq i8 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = icmp eq i32 %11, 1
br i1 %15, label %21, label %16
16: ; preds = %9, %14
%17 = phi i32 [ 1, %14 ], [ 0, %9 ]
%18 = add nuw nsw i64 %10, 1
%19 = getelementptr inbounds [20000 x i8], [20000 x i8]* %2, i64 0, i64 %10
store i8 %12, i8* %19
%20 = icmp eq i64 %18, 19999
br i1 %20, label %21, label %9
21: ; preds = %16, %14
%22 = call i8* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i8* %22, null
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = getelementptr inbounds i8, i8* %22, i64 49
%26 = call i32 @atoi(i8* %25)
br label %27
27: ; preds = %21, %24
%28 = phi i32 [ %26, %24 ], [ 0, %21 ]
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %7
%31 = phi i32 [ 2, %7 ], [ 0, %27 ]
ret i32 %31
}