#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);
int trailingZerosInFact(int);
void testTrailingZerosInFact() {
  int ns[] = {3, 60, 100, 1024, 23456, 8735373};
  int size = 6, tz = 0;
  for (int i = 0; i < size; i++) {
    tz = trailingZerosInFact(ns[i]);
    printf("number of trailing zeros in %d! = %d\n", ns[i], tz);
  }
}


x86 assembly (clang, -O0):
<testTrailingZerosInFact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    119f <testTrailingZerosInFact+0x7f>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
call   1030 <trailingZerosInFact@plt>
mov    %eax,-0x28(%rbp)
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
mov    -0x28(%rbp),%edx
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115e <testTrailingZerosInFact+0x3e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testTrailingZerosInFact>:
push   %rbx
mov    $0x3,%edi
call   1030 <trailingZerosInFact@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x3c,%edi
call   1030 <trailingZerosInFact@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x64,%edi
call   1030 <trailingZerosInFact@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x400,%edi
call   1030 <trailingZerosInFact@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x5ba0,%edi
call   1030 <trailingZerosInFact@plt>
mov    %rbx,%rdi
mov    $0x5ba0,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x854a8d,%edi
call   1030 <trailingZerosInFact@plt>
mov    %rbx,%rdi
mov    $0x854a8d,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@__const.testTrailingZerosInFact.ns = [6 x i32] [i32 3, i32 60, i32 100, i32 1024, i32 23456, i32 8735373]
@.str = [38 x i8] c"number of trailing zeros in %d! = %d\0A\00"
define void @testTrailingZerosInFact() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [6 x i32]* %1 to i8*
store i32 6, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %22, %0
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = call i32 @trailingZerosInFact(i32 %14)
store i32 %15, i32* %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20)
br label %22
22: ; preds = %10
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %6
25: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"number of trailing zeros in %d! = %d\0A\00"
define void @testTrailingZerosInFact() {
%1 = tail call i32 @trailingZerosInFact(i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 3, i32 %1)
%3 = tail call i32 @trailingZerosInFact(i32 60)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 60, i32 %3)
%5 = tail call i32 @trailingZerosInFact(i32 100)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 100, i32 %5)
%7 = tail call i32 @trailingZerosInFact(i32 1024)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 1024, i32 %7)
%9 = tail call i32 @trailingZerosInFact(i32 23456)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 23456, i32 %9)
%11 = tail call i32 @trailingZerosInFact(i32 8735373)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 8735373, i32 %11)
ret void
}