#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 *, long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long int sum = 0;
    long int n;
    scanf("%ld", &n);
    if (1 > n)
      return 0;
    if (n > 1000000000)
      return 0;
    while (n / 5) {
      n = n / 5;
      sum += n;
    }
    printf("%ld\n", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11f9 <main+0xd9>
movq   $0x0,-0x10(%rbp)
lea    0xe9f(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    $0x1,%eax
cmp    -0x18(%rbp),%rax
jle    118a <main+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1200 <main+0xe0>
cmpq   $0x3b9aca00,-0x18(%rbp)
3b
jle    11a4 <main+0x84>
movl   $0x0,-0x4(%rbp)
jmp    1200 <main+0xe0>
jmp    11a9 <main+0x89>
mov    -0x18(%rbp),%rax
mov    $0x5,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rax
je     11e4 <main+0xc4>
mov    -0x18(%rbp),%rax
mov    $0x5,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    11a9 <main+0x89>
mov    -0x10(%rbp),%rsi
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1153 <main+0x33>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xea9(%rip),%r14
lea    0x10(%rsp),%r12
lea    0xea1(%rip),%r15
movabs $0x6666666666666667,%rbx
66 66 66
jmp    118f <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jb     1145 <main+0x25>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rax
lea    -0x3b9aca01(%rax),%rcx
cmp    $0xffffffffc4653600,%rcx
jb     1145 <main+0x25>
xor    %esi,%esi
cmp    $0x5,%rax
jb     1180 <main+0x60>
nopl   0x0(%rax)
imul   %rbx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    %rdx
lea    (%rdx,%rcx,1),%rax
add    %rax,%rsi
add    %rdx,%rcx
add    $0x4,%rcx
cmp    $0x8,%rcx
ja     11c0 <main+0xa0>
mov    %rax,0x10(%rsp)
jmp    1180 <main+0x60>

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

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