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

/* Variables and functions */
int getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n, k, d = 0, c, l = 0;
  scanf("%d %d\n", &n, &k);
  while ((c = getchar()) > 0) {
    if (c >= '0' && c <= '9')
      l += (c == '4' || c == '7');
    else {
      d += (l <= k);
      l = 0;
    }
  }
  printf("%d", d);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    11d4 <main+0xa4>
cmpl   $0x30,-0x14(%rbp)
jl     11b4 <main+0x84>
cmpl   $0x39,-0x14(%rbp)
jg     11b4 <main+0x84>
mov    $0x1,%al
cmpl   $0x34,-0x14(%rbp)
mov    %al,-0x19(%rbp)
je     11a1 <main+0x71>
cmpl   $0x37,-0x14(%rbp)
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11cf <main+0x9f>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    1161 <main+0x31>
mov    -0x10(%rbp),%esi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
test   %eax,%eax
jle    1194 <main+0x64>
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1177 <main+0x47>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
cmp    (%rsp),%ebp
setle  %al
add    %eax,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
test   %eax,%eax
jle    1194 <main+0x64>
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
ja     1160 <main+0x30>
cmp    $0x34,%eax
sete   %cl
cmp    $0x37,%eax
sete   %al
or     %cl,%al
movzbl %al,%eax
add    %eax,%ebp
jmp    116c <main+0x3c>
lea    0xe6c(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
br label %8
8: ; preds = %35, %0
%9 = call i32 (...) @getchar()
store i32 %9, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %36
11: ; preds = %8
%12 = load i32, i32* %5
%13 = icmp sge i32 %12, 48
br i1 %13, label %14, label %28
14: ; preds = %11
%15 = load i32, i32* %5
%16 = icmp sle i32 %15, 57
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 52
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 55
br label %23
23: ; preds = %20, %17
%24 = phi i1 [ true, %17 ], [ %22, %20 ]
%25 = zext i1 %24 to i32
%26 = load i32, i32* %6
%27 = add nsw i32 %26, %25
store i32 %27, i32* %6
br label %35
28: ; preds = %14, %11
%29 = load i32, i32* %6
%30 = load i32, i32* %3
%31 = icmp sle i32 %29, %30
%32 = zext i1 %31 to i32
%33 = load i32, i32* %4
%34 = add nsw i32 %33, %32
store i32 %34, i32* %4
store i32 0, i32* %6
br label %35
35: ; preds = %28, %23
br label %8
36: ; preds = %8
%37 = load i32, i32* %4
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = call i32 (...) @getchar()
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %30
8: ; preds = %0, %25
%9 = phi i32 [ %28, %25 ], [ %6, %0 ]
%10 = phi i32 [ %27, %25 ], [ 0, %0 ]
%11 = phi i32 [ %26, %25 ], [ 0, %0 ]
%12 = add nsw i32 %9, -48
%13 = icmp ult i32 %12, 10
br i1 %13, label %14, label %20
14: ; preds = %8
%15 = icmp eq i32 %9, 52
%16 = icmp eq i32 %9, 55
%17 = or i1 %15, %16
%18 = zext i1 %17 to i32
%19 = add nsw i32 %10, %18
br label %25
20: ; preds = %8
%21 = load i32, i32* %2
%22 = icmp sle i32 %10, %21
%23 = zext i1 %22 to i32
%24 = add nsw i32 %11, %23
br label %25
25: ; preds = %20, %14
%26 = phi i32 [ %11, %14 ], [ %24, %20 ]
%27 = phi i32 [ %19, %14 ], [ 0, %20 ]
%28 = call i32 (...) @getchar()
%29 = icmp sgt i32 %28, 0
br i1 %29, label %8, label %30
30: ; preds = %25, %0
%31 = phi i32 [ 0, %0 ], [ %26, %25 ]
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %31)
ret i32 0
}