#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 t, n, z, i, p[12] = {5};
  for (i = 1; i < 12; ++i)
    p[i] = 5 * p[i - 1];
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (i = z = 0; i < 12; ++i)
      z += n / p[i];
    printf("%d\n", z);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
movl   $0x5,-0x50(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jge    118a <main+0x5a>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
imul   $0x5,-0x50(%rbp,%rax,4),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x2d>
lea    0xe6f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     120a <main+0xda>
lea    0xe4b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jge    11f6 <main+0xc6>
mov    -0xc(%rbp),%eax
movslq -0x14(%rbp),%rcx
cltd
idivl  -0x50(%rbp,%rcx,4)
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cc <main+0x9c>
mov    -0x10(%rbp),%esi
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
jmp    119a <main+0x6a>
xor    %eax,%eax
add    $0x50,%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)
jb     1289 <main+0x169>
lea    0xeb4(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xeab(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
imul   $0x51eb851f,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x23,%rdx
add    %esi,%edx
add    %ecx,%edx
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x23,%rcx
add    %esi,%ecx
add    %edx,%ecx
imul   $0x68db8bad,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x28,%rdx
add    %esi,%edx
add    %ecx,%edx
imul   $0x14f8b589,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x28,%rcx
add    %esi,%ecx
add    %edx,%ecx
imul   $0x431bde83,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x2c,%rdx
add    %esi,%edx
add    %ecx,%edx
imul   $0x6b5fca6b,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x2f,%rcx
add    %esi,%ecx
add    %edx,%ecx
imul   $0x55e63b89,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x31,%rdx
add    %esi,%edx
add    %ecx,%edx
imul   $0x44b82fa1,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x33,%rcx
add    %esi,%ecx
add    %edx,%ecx
imul   $0xdbe6fed,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x33,%rdx
add    %esi,%edx
add    %ecx,%edx
imul   $0x2bfaffc3,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x37,%rcx
add    %esi,%ecx
add    %edx,%ecx
imul   $0x465e6605,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x3a,%rsi
add    %eax,%esi
add    %ecx,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jae    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [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
%6 = alloca [12 x i32]
store i32 0, i32* %1
%7 = bitcast [12 x i32]* %6 to i8*
%8 = bitcast i8* %7 to <{ i32, [11 x i32] }>*
%9 = getelementptr inbounds <{ i32, [11 x i32] }>, <{ i32, [11 x i32] }>* %8, i32 0, i32 0
store i32 5, i32* %9
store i32 1, i32* %5
br label %10
10: ; preds = %23, %0
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 12
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = mul nsw i32 5, %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 %21
store i32 %19, i32* %22
br label %23
23: ; preds = %13
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %10
26: ; preds = %10
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %28
28: ; preds = %49, %26
%29 = load i32, i32* %2
%30 = add nsw i32 %29, -1
store i32 %30, i32* %2
%31 = icmp ne i32 %29, 0
br i1 %31, label %32, label %52
32: ; preds = %28
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
store i32 0, i32* %5
br label %34
34: ; preds = %46, %32
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 12
br i1 %36, label %37, label %49
37: ; preds = %34
%38 = load i32, i32* %3
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = sdiv i32 %38, %42
%44 = load i32, i32* %4
%45 = add nsw i32 %44, %43
store i32 %45, i32* %4
br label %46
46: ; preds = %37
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %34
49: ; preds = %34
%50 = load i32, i32* %4
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
br label %28
52: ; preds = %28
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %39, label %9
9: ; preds = %0, %9
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 5
%13 = sdiv i32 %11, 25
%14 = add nsw i32 %13, %12
%15 = sdiv i32 %11, 125
%16 = add nsw i32 %15, %14
%17 = sdiv i32 %11, 625
%18 = add nsw i32 %17, %16
%19 = sdiv i32 %11, 3125
%20 = add nsw i32 %19, %18
%21 = sdiv i32 %11, 15625
%22 = add nsw i32 %21, %20
%23 = sdiv i32 %11, 78125
%24 = add nsw i32 %23, %22
%25 = sdiv i32 %11, 390625
%26 = add nsw i32 %25, %24
%27 = sdiv i32 %11, 1953125
%28 = add nsw i32 %27, %26
%29 = sdiv i32 %11, 9765625
%30 = add nsw i32 %29, %28
%31 = sdiv i32 %11, 48828125
%32 = add nsw i32 %31, %30
%33 = sdiv i32 %11, 244140625
%34 = add nsw i32 %33, %32
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %1
%37 = add nsw i32 %36, -1
store i32 %37, i32* %1
%38 = icmp eq i32 %36, 0
br i1 %38, label %39, label %9
39: ; preds = %9, %0
ret i32 0
}