#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 pow(double, float);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int iterations;
  int zeros;
  float power;
  int number;
  scanf("%d", &iterations);
  for (int i = 0; i < iterations; ++i) {
    zeros = 0;
    power = 1.0;
    scanf("%d", &number);
    while (pow(5.0, power) <= number) {
      zeros += number / pow(5.0, power);
      power += 1.0;
    }
    printf("%d\n", zeros);
  }
  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    0xecb(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120e <main+0xde>
movl   $0x0,-0x18(%rbp)
movss  0xe88(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xe94(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x1c(%rbp),%xmm1
movsd  0xe6e(%rip),%xmm0
call   1050 <pow@plt>
cmp    -0x20(%rbp),%eax
jg     11f1 <main+0xc1>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm1
movsd  0xe4d(%rip),%xmm0
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cltd
idiv   %ecx
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe31(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    118d <main+0x5d>
mov    -0x18(%rbp),%esi
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115d <main+0x2d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec7(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    122a <main+0xfa>
xor    %r13d,%r13d
lea    0xea8(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xe9f(%rip),%r12
jmp    1199 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%r13d
cmp    0x14(%rsp),%r13d
jge    122a <main+0xfa>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movsd  0xe54(%rip),%xmm0
movss  0xe54(%rip),%xmm1
call   1050 <pow@plt>
mov    0x10(%rsp),%ebx
mov    $0x0,%ebp
cmp    %ebx,%eax
jg     1180 <main+0x50>
xor    %ebp,%ebp
movss  0xe38(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
movsd  0xe18(%rip),%xmm0
movss  0xc(%rsp),%xmm1
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
add    %eax,%ebp
movss  0xc(%rsp),%xmm1
addss  0xdfe(%rip),%xmm1
movsd  0xdee(%rip),%xmm0
movss  %xmm1,0xc(%rsp)
call   1050 <pow@plt>
mov    0x10(%rsp),%ebx
cmp    %ebx,%eax
jle    11e0 <main+0xb0>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%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* %6)
store i32 0, i32* %10
br label %12
12: ; preds = %37, %2
%13 = load i32, i32* %10
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %40
16: ; preds = %12
store i32 0, i32* %7
store float 1.000000e+00, float* %8
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
br label %18
18: ; preds = %23, %16
%19 = load float, float* %8
%20 = call i32 @pow(double 5.000000e+00, float %19)
%21 = load i32, i32* %9
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %34
23: ; preds = %18
%24 = load i32, i32* %9
%25 = load float, float* %8
%26 = call i32 @pow(double 5.000000e+00, float %25)
%27 = sdiv i32 %24, %26
%28 = load i32, i32* %7
%29 = add nsw i32 %28, %27
store i32 %29, i32* %7
%30 = load float, float* %8
%31 = fpext float %30 to double
%32 = fadd double %31, 1.000000e+00
%33 = fptrunc double %32 to float
store float %33, float* %8
br label %18
34: ; preds = %18
%35 = load i32, i32* %7
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %10
%39 = add nsw i32 %38, 1
store i32 %39, i32* %10
br label %12
40: ; preds = %12
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(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* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %28, %2
ret i32 0
11: ; preds = %2, %28
%12 = phi i32 [ %31, %28 ], [ 0, %2 ]
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%14 = call i32 @pow(double 5.000000e+00, float 1.000000e+00)
%15 = load i32, i32* %4
%16 = icmp sgt i32 %14, %15
br i1 %16, label %28, label %17
17: ; preds = %11, %17
%18 = phi i32 [ %26, %17 ], [ %15, %11 ]
%19 = phi float [ %24, %17 ], [ 1.000000e+00, %11 ]
%20 = phi i32 [ %23, %17 ], [ 0, %11 ]
%21 = call i32 @pow(double 5.000000e+00, float %19)
%22 = sdiv i32 %18, %21
%23 = add nsw i32 %22, %20
%24 = fadd float %19, 1.000000e+00
%25 = call i32 @pow(double 5.000000e+00, float %24)
%26 = load i32, i32* %4
%27 = icmp sgt i32 %25, %26
br i1 %27, label %28, label %17
28: ; preds = %17, %11
%29 = phi i32 [ 0, %11 ], [ %23, %17 ]
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = add nuw nsw i32 %12, 1
%32 = load i32, i32* %3
%33 = icmp slt i32 %31, %32
br i1 %33, label %11, label %10
}