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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int sscanf(char *, char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char buffer[100], pattern[4];
  char str[] = "C is a general-purpose, imperative computer programming "
               "language, supporting structured programming, lexical variable "
               "scope and recursion, while a static type system prevents many "
               "unintended operations.";
  int cnt = 0;
  if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
    exit(EXIT_FAILURE);
  }
  if (sscanf(buffer, "%s", pattern) != 1) {
    exit(EXIT_FAILURE);
  }
  for (int i = 0; str[i] != '\0'; i++) {
    if (str[i] == pattern[0]) {
      if (str[i + 1] == pattern[1]) {
        if (str[i + 2] == pattern[2]) {
          cnt++;
        }
      }
    }
  }
  printf("%d", cnt);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x140(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0xcb,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x144(%rbp)
lea    -0x70(%rbp),%rdi
mov    0x2e59(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    11b3 <main+0x63>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    -0x70(%rbp),%rdi
lea    -0x74(%rbp),%rdx
lea    0xf09(%rip),%rsi
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     11de <main+0x8e>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
movl   $0x0,-0x148(%rbp)
movslq -0x148(%rbp),%rax
movsbl -0x140(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     128b <main+0x13b>
movslq -0x148(%rbp),%rax
movsbl -0x140(%rbp,%rax,1),%eax
ff
movsbl -0x74(%rbp),%ecx
cmp    %ecx,%eax
jne    1272 <main+0x122>
mov    -0x148(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x140(%rbp,%rax,1),%eax
ff
movsbl -0x73(%rbp),%ecx
cmp    %ecx,%eax
jne    126d <main+0x11d>
mov    -0x148(%rbp),%eax
add    $0x2,%eax
cltq
movsbl -0x140(%rbp,%rax,1),%eax
ff
movsbl -0x72(%rbp),%ecx
cmp    %ecx,%eax
jne    1268 <main+0x118>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    126d <main+0x11d>
jmp    1272 <main+0x122>
jmp    1277 <main+0x127>
mov    -0x148(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x148(%rbp)
jmp    11e8 <main+0x98>
mov    -0x144(%rbp),%esi
lea    0xe36(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x78,%rsp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11fa <main+0xba>
lea    0xf5f(%rip),%rsi
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11fa <main+0xba>
mov    0xc(%rsp),%al
mov    0xd(%rsp),%r9b
xor    %esi,%esi
mov    $0x3,%edx
mov    0xe(%rsp),%r8b
lea    0xe64(%rip),%rdi
jmp    11ad <main+0x6d>
xchg   %ax,%ax
add    $0x2,%rdx
cmp    $0xcd,%rdx
je     11e0 <main+0xa0>
cmp    %al,-0x3(%rdx,%rdi,1)
jne    11c6 <main+0x86>
cmp    %r9b,-0x2(%rdx,%rdi,1)
jne    11c6 <main+0x86>
xor    %ecx,%ecx
cmp    %r8b,-0x1(%rdx,%rdi,1)
sete   %cl
add    %ecx,%esi
cmp    %al,-0x2(%rdx,%rdi,1)
jne    11a0 <main+0x60>
cmp    %r9b,-0x1(%rdx,%rdi,1)
jne    11a0 <main+0x60>
xor    %ecx,%ecx
cmp    %r8b,(%rdx,%rdi,1)
sete   %cl
add    %ecx,%esi
jmp    11a0 <main+0x60>
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ddd(%rip),%rax
mov    (%rax),%eax
add    $0x78,%rsp
ret
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@__const.main.str = [203 x i8] c"C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations.\00"
@stdin = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [4 x i8]
%4 = alloca [203 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [203 x i8]* %4 to i8*
store i32 0, i32* %5
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %8, i32 100, i32 %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%18 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %15
store i32 0, i32* %6
br label %24
24: ; preds = %69, %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [203 x i8], [203 x i8]* %4, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %72
31: ; preds = %24
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [203 x i8], [203 x i8]* %4, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %36, %39
br i1 %40, label %41, label %68
41: ; preds = %31
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [203 x i8], [203 x i8]* %4, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %47, %50
br i1 %51, label %52, label %67
52: ; preds = %41
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 2
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [203 x i8], [203 x i8]* %4, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %58, %61
br i1 %62, label %63, label %66
63: ; preds = %52
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
br label %66
66: ; preds = %63, %52
br label %67
67: ; preds = %66, %41
br label %68
68: ; preds = %67, %31
br label %69
69: ; preds = %68
%70 = load i32, i32* %6
%71 = add nsw i32 %70, 1
store i32 %71, i32* %6
br label %24
72: ; preds = %24
%73 = load i32, i32* %5
%74 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %73)
%75 = load i32, i32* @EXIT_SUCCESS
ret i32 %75
}

LLVM IR (-O2):
@__const.main.str = [203 x i8] c"C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations.\00"
@stdin = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %3, i32 100, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i8, i8* %4
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%17 = load i8, i8* %16
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%19 = load i8, i8* %18
br label %26
20: ; preds = %11
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %61
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
26: ; preds = %61, %14
%27 = phi i64 [ 0, %14 ], [ %49, %61 ]
%28 = phi i32 [ 0, %14 ], [ %62, %61 ]
%29 = getelementptr inbounds [203 x i8], [203 x i8]* @__const.main.str, i64 0, i64 %27
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, %15
%32 = or i64 %27, 1
br i1 %31, label %33, label %44
33: ; preds = %26
%34 = getelementptr inbounds [203 x i8], [203 x i8]* @__const.main.str, i64 0, i64 %32
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, %17
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = add nuw nsw i64 %27, 2
%39 = getelementptr inbounds [203 x i8], [203 x i8]* @__const.main.str, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, %19
%42 = zext i1 %41 to i32
%43 = add nsw i32 %28, %42
br label %44
44: ; preds = %26, %37, %33
%45 = phi i32 [ %43, %37 ], [ %28, %33 ], [ %28, %26 ]
%46 = getelementptr inbounds [203 x i8], [203 x i8]* @__const.main.str, i64 0, i64 %32
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, %15
%49 = add nuw nsw i64 %27, 2
br i1 %48, label %50, label %61
50: ; preds = %44
%51 = getelementptr inbounds [203 x i8], [203 x i8]* @__const.main.str, i64 0, i64 %49
%52 = load i8, i8* %51
%53 = icmp eq i8 %52, %17
br i1 %53, label %54, label %61
54: ; preds = %50
%55 = add nuw i64 %27, 3
%56 = getelementptr inbounds [203 x i8], [203 x i8]* @__const.main.str, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = icmp eq i8 %57, %19
%59 = zext i1 %58 to i32
%60 = add nsw i32 %45, %59
br label %61
61: ; preds = %54, %50, %44
%62 = phi i32 [ %60, %54 ], [ %45, %50 ], [ %45, %44 ]
%63 = icmp eq i64 %49, 202
br i1 %63, label %23, label %26
}