#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 /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  long long unsigned int fact5, num = 0;
  int inpCnt = 0;
  scanf("%d", &inpCnt);
  int count = 0;
  for (count = 0; count < inpCnt; count++) {
    fact5 = 0;
    scanf("%llu", &num);
    int factCheck = 5;
    while (factCheck <= num) {
      fact5 += num / factCheck;
      factCheck *= 5;
    }
    printf("%llu\n", fact5);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xebb(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d8 <main+0xb8>
movq   $0x0,-0x10(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x5,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     11ba <main+0x9a>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
xor    %edx,%edx
div    %rcx
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
imul   $0x5,-0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    118b <main+0x6b>
mov    -0x10(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115e <main+0x3e>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11d6 <main+0xb6>
lea    0xea5(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xe9e(%rip),%r12
xor    %ebp,%ebp
jmp    1183 <main+0x63>
xchg   %ax,%ax
xor    %esi,%esi
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jge    11d6 <main+0xb6>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%rcx
cmp    $0x5,%rcx
jb     1170 <main+0x50>
mov    $0x5,%ebx
mov    $0x5,%edi
xor    %esi,%esi
jmp    11c5 <main+0xa5>
nopl   0x0(%rax)
mov    %rcx,%rax
xor    %edx,%edx
div    %rdi
add    %rax,%rsi
lea    (%rbx,%rbx,4),%edi
mov    %edi,%ebx
cmp    %rdi,%rcx
jb     1172 <main+0x52>
mov    %rcx,%rax
shr    $0x20,%rax
jne    11b0 <main+0x90>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
jmp    11b8 <main+0x98>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %3
store i32 0, i32* %4
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
store i32 0, i32* %5
br label %8
8: ; preds = %31, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %34
12: ; preds = %8
store i64 0, i64* %2
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %3)
store i32 5, i32* %6
br label %14
14: ; preds = %19, %12
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = load i64, i64* %3
%18 = icmp ule i64 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %14
%20 = load i64, i64* %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = udiv i64 %20, %22
%24 = load i64, i64* %2
%25 = add i64 %24, %23
store i64 %25, i64* %2
%26 = load i32, i32* %6
%27 = mul nsw i32 %26, 5
store i32 %27, i32* %6
br label %14
28: ; preds = %14
%29 = load i64, i64* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %29)
br label %31
31: ; preds = %28
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %8
34: ; preds = %8
ret i32 0
}

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