#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 */
struct timeval {
  int dummy;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, double, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ timeval_subtract(double *, struct timeval *,
                                    struct timeval *);
int main() {
  int n, k;
  int count = 0;
  int a;
  struct timeval tdr0, tdr1;
  double restime;
  char string[12];
  scanf("%d %d", &n, &k);
  gettimeofday(&tdr0, NULL);
  while (n > 0) {
    gets(string);
    a = atoi(string);
    if (a % k == 0 && a > 0)
      count++;
    n--;
  }
  gettimeofday(&tdr1, NULL);
  timeval_subtract(&restime, &tdr1, &tdr0);
  printf("%e\t%d\n", restime, count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe83(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1070 <scanf@plt>
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11e7 <main+0x87>
lea    -0x34(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x34(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11d9 <main+0x79>
cmpl   $0x0,-0x14(%rbp)
jle    11d9 <main+0x79>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1197 <main+0x37>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <timeval_subtract@plt>
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%esi
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xe92(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1070 <scanf@plt>
xor    %ebx,%ebx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
cmpl   $0x0,0x4(%rsp)
jle    11d8 <main+0x78>
xor    %ebx,%ebx
lea    0x1c(%rsp),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
call   1080 <atoi@plt>
mov    %eax,%ecx
cltd
idivl  0xc(%rsp)
test   %edx,%edx
sete   %al
test   %ecx,%ecx
setg   %cl
and    %al,%cl
movzbl %cl,%eax
add    %eax,%ebx
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x1,%eax
jg     11a0 <main+0x40>
lea    0x18(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    %r14,%rsi
call   1050 <timeval_subtract@plt>
movsd  0x10(%rsp),%xmm0
lea    0xe00(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%e\09%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.timeval
%7 = alloca %struct.timeval
%8 = alloca double
%9 = alloca [12 x i8]
store i32 0, i32* %1
store i32 0, i32* %4
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%11 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
br label %12
12: ; preds = %30, %0
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %33
15: ; preds = %12
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%17 = call i32 @gets(i8* %16)
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = load i32, i32* %3
%22 = srem i32 %20, %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %15
%25 = load i32, i32* %5
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %30
30: ; preds = %27, %24, %15
%31 = load i32, i32* %2
%32 = add nsw i32 %31, -1
store i32 %32, i32* %2
br label %12
33: ; preds = %12
%34 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%35 = call i32 @timeval_subtract(double* %8, %struct.timeval* %7, %struct.timeval* %6)
%36 = load double, double* %8
%37 = load i32, i32* %4
%38 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %36, i32 %37)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%e\09%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca double
%6 = alloca [12 x i8]
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast %struct.timeval* %3 to i8*
%10 = bitcast %struct.timeval* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%14 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %31
17: ; preds = %0, %17
%18 = phi i32 [ %27, %17 ], [ 0, %0 ]
%19 = call i32 @gets(i8* %12)
%20 = call i32 @atoi(i8* %12)
%21 = load i32, i32* %2
%22 = srem i32 %20, %21
%23 = icmp eq i32 %22, 0
%24 = icmp sgt i32 %20, 0
%25 = and i1 %24, %23
%26 = zext i1 %25 to i32
%27 = add nuw nsw i32 %18, %26
%28 = load i32, i32* %1
%29 = add nsw i32 %28, -1
store i32 %29, i32* %1
%30 = icmp sgt i32 %28, 1
br i1 %30, label %17, label %31
31: ; preds = %17, %0
%32 = phi i32 [ 0, %0 ], [ %27, %17 ]
%33 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%34 = call i32 @timeval_subtract(double* %5, %struct.timeval* %4, %struct.timeval* %3)
%35 = load double, double* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %35, i32 %32)
ret i32 0
}