#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int count, fct, i, n, test;
  scanf("%d", &test);
  while (test--) {
    scanf("%d", &n);
    for (i = 5, count = 0; i <= n; i *= 5) {
      count += n / i;
    }
    printf("%d\n", count);
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x24(%rbp)
cmp    $0x0,%eax
je     11b1 <main+0x91>
lea    0xe9f(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x5,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     119d <main+0x7d>
mov    -0x20(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
imul   $0x5,-0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1178 <main+0x58>
mov    -0x14(%rbp),%esi
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x26>
mov    0x2e28(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    1154 <main+0x34>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xea5(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe9c(%rip),%rbx
jmp    117f <main+0x5f>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jb     1141 <main+0x21>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
xor    %esi,%esi
cmp    $0x5,%ecx
jl     1170 <main+0x50>
xor    %esi,%esi
mov    $0x5,%edi
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %edi
add    %eax,%esi
lea    (%rdi,%rdi,4),%edi
cmp    %ecx,%edi
jle    11a0 <main+0x80>
jmp    1170 <main+0x50>

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

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