#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(void) {
  int count[100] = {0}, temp, five, i, j;
  for (i = 0;; i++) {
    five = 5;
    scanf("%d", &temp);
    if (temp == 0)
      break;
    while (1) {
      if (temp >= five) {
        count[i] += temp / five;
      } else {
        break;
      }
      five *= 5;
    }
  }
  for (j = 0; j < i; j++)
    printf("%d\n", count[j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
movl   $0x0,-0x1ac(%rbp)
movl   $0x5,-0x1a8(%rbp)
lea    0xe90(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x1a4(%rbp)
jne    118e <main+0x5e>
jmp    11fe <main+0xce>
jmp    1193 <main+0x63>
mov    -0x1a4(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jl     11ce <main+0x9e>
mov    -0x1a4(%rbp),%eax
cltd
idivl  -0x1a8(%rbp)
mov    %eax,%ecx
movslq -0x1ac(%rbp),%rax
add    -0x1a0(%rbp,%rax,4),%ecx
mov    %ecx,-0x1a0(%rbp,%rax,4)
jmp    11d3 <main+0xa3>
jmp    11e5 <main+0xb5>
imul   $0x5,-0x1a8(%rbp),%eax
mov    %eax,-0x1a8(%rbp)
jmp    1193 <main+0x63>
jmp    11ea <main+0xba>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    115f <main+0x2f>
movl   $0x0,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%eax
cmp    -0x1ac(%rbp),%eax
jge    1248 <main+0x118>
movslq -0x1b0(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xdd4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
jmp    1208 <main+0xd8>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0x10(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     1205 <main+0xd5>
mov    $0x1,%eax
xor    %ebx,%ebx
lea    0xe86(%rip),%r14
lea    0xc(%rsp),%r15
jmp    11ac <main+0x7c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%r12),%eax
test   %ecx,%ecx
je     11d4 <main+0xa4>
mov    %eax,%r12d
cmp    $0x5,%ecx
jl     1190 <main+0x60>
mov    0x10(%rsp,%rbx,4),%esi
mov    $0x5,%edi
nopl   (%rax)
mov    %ecx,%eax
cltd
idiv   %edi
add    %eax,%esi
lea    (%rdi,%rdi,4),%edi
cmp    %edi,%ecx
jge    11c0 <main+0x90>
mov    %esi,0x10(%rsp,%rbx,4)
jmp    1190 <main+0x60>
test   %ebx,%ebx
je     1205 <main+0xd5>
mov    %r12d,%r15d
xor    %ebx,%ebx
lea    0xe1f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11f0 <main+0xc0>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
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 [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [100 x i32]* %2 to i8*
store i32 0, i32* %5
br label %8
8: ; preds = %32, %0
store i32 5, i32* %4
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %35
13: ; preds = %8
br label %14
14: ; preds = %13, %28
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = icmp sge i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = sdiv i32 %19, %20
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %25, %21
store i32 %26, i32* %24
br label %28
27: ; preds = %14
br label %31
28: ; preds = %18
%29 = load i32, i32* %4
%30 = mul nsw i32 %29, 5
store i32 %30, i32* %4
br label %14
31: ; preds = %27
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %8
35: ; preds = %12
store i32 0, i32* %6
br label %36
36: ; preds = %46, %35
%37 = load i32, i32* %6
%38 = load i32, i32* %5
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %49
40: ; preds = %36
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %40
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %36
49: ; preds = %36
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 [100 x i32]
%2 = alloca i32
%3 = bitcast [100 x 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* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %40, label %8
8: ; preds = %0, %28
%9 = phi i64 [ %29, %28 ], [ 0, %0 ]
%10 = phi i32 [ %31, %28 ], [ %6, %0 ]
%11 = icmp slt i32 %10, 5
br i1 %11, label %28, label %12
12: ; preds = %8
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %9
%14 = load i32, i32* %13
br label %20
15: ; preds = %28
%16 = trunc i64 %29 to i32
%17 = icmp eq i32 %16, 0
br i1 %17, label %40, label %18
18: ; preds = %15
%19 = and i64 %29, 4294967295
br label %33
20: ; preds = %12, %20
%21 = phi i32 [ %14, %12 ], [ %24, %20 ]
%22 = phi i32 [ 5, %12 ], [ %25, %20 ]
%23 = sdiv i32 %10, %22
%24 = add nsw i32 %21, %23
%25 = mul nsw i32 %22, 5
%26 = icmp slt i32 %10, %25
br i1 %26, label %27, label %20
27: ; preds = %20
store i32 %24, i32* %13
br label %28
28: ; preds = %27, %8
%29 = add nuw i64 %9, 1
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 0
br i1 %32, label %15, label %8
33: ; preds = %18, %33
%34 = phi i64 [ 0, %18 ], [ %38, %33 ]
%35 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = add nuw nsw i64 %34, 1
%39 = icmp eq i64 %38, %19
br i1 %39, label %40, label %33
40: ; preds = %33, %0, %15
ret i32 0
}