#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 *, long *);
int main(int argc, char const *argv[]) {
  long n;
  long input, output;
  scanf("%ld", &n);
  while (n) {
    n--;
    scanf("%ld", &input);
    output = 0;
    while (input) {
      output += input / 5;
      input /= 5;
    }
    printf("%ld\n", output);
  }
  return 0;
}


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    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x18(%rbp)
je     11c2 <main+0xa2>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
lea    0xe9c(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11ad <main+0x8d>
mov    -0x20(%rbp),%rax
mov    $0x5,%ecx
cqto
idiv   %rcx
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    $0x5,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
jmp    1175 <main+0x55>
mov    -0x28(%rbp),%rsi
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x30,%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    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     11da <main+0xba>
lea    0xeaf(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xea7(%rip),%r12
movabs $0x6666666666666667,%rbx
66 66 66
jmp    1182 <main+0x62>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     11da <main+0xba>
add    $0xffffffffffffffff,%rax
mov    %rax,0x8(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x10(%rsp),%rdx
xor    %esi,%esi
test   %rdx,%rdx
je     1170 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rdx,%rcx
mov    %rdx,%rax
imul   %rbx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    %rdx
add    %rax,%rdx
add    %rdx,%rsi
add    $0x4,%rcx
cmp    $0x8,%rcx
ja     11b0 <main+0x90>
mov    %rdx,0x10(%rsp)
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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