#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 *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int test_count;
  int number;
  int number_of_zeroes;
  scanf("%d\n", &test_count);
  while (test_count > 0) {
    number_of_zeroes = 0;
    scanf("%d\n", &number);
    int divider = 5;
    while (divider < number) {
      number_of_zeroes += (number / divider);
      divider *= 5;
    }
    printf("%d\n", number_of_zeroes);
    test_count--;
  }
  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
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11a9 <main+0x89>
movl   $0x0,-0x10(%rbp)
lea    0xea9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118c <main+0x6c>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
imul   $0x5,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1167 <main+0x47>
mov    -0x10(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11a0 <main+0x80>
lea    0xec0(%rip),%rbx
lea    0x4(%rsp),%r14
jmp    1166 <main+0x46>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    (%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,(%rsp)
cmp    $0x1,%eax
jle    11a0 <main+0x80>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
xor    %esi,%esi
cmp    $0x6,%ecx
jl     1150 <main+0x30>
xor    %esi,%esi
mov    $0x5,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ecx,%eax
cltd
idiv   %edi
add    %eax,%esi
lea    (%rdi,%rdi,4),%edi
cmp    %ecx,%edi
jl     1190 <main+0x70>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %25
8: ; preds = %0, %19
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 5
br i1 %11, label %12, label %19
12: ; preds = %8, %12
%13 = phi i32 [ %17, %12 ], [ 5, %8 ]
%14 = phi i32 [ %16, %12 ], [ 0, %8 ]
%15 = sdiv i32 %10, %13
%16 = add nsw i32 %15, %14
%17 = mul nsw i32 %13, 5
%18 = icmp slt i32 %17, %10
br i1 %18, label %12, label %19
19: ; preds = %12, %8
%20 = phi i32 [ 0, %8 ], [ %16, %12 ]
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
%23 = add nsw i32 %22, -1
store i32 %23, i32* %1
%24 = icmp sgt i32 %22, 1
br i1 %24, label %8, label %25
25: ; preds = %19, %0
ret i32 0
}