#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
scalar_t__ mpz_cmp_ui(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_si(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_init_set_ui(int /*<<< orphan*/, int);
scalar_t__ mpz_mod_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_mul_si(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_tdiv_q(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void main(void) {
  int i;
  mpz_t prod, x;
  mpz_init_set_si(prod, 1);
  for (i = 2; i <= 100; ++i) {
    mpz_mul_si(prod, prod, i);
  }
  i = 0;
  mpz_init(x);
  while (mpz_cmp_ui(prod, 0)) {
    i += mpz_mod_ui(x, prod, 10);
    mpz_init_set_ui(x, 10);
    mpz_tdiv_q(prod, prod, x);
  }
  printf("%d\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   10a0 <mpz_init_set_si@plt>
movl   $0x2,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     11c2 <main+0x42>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1030 <mpz_mul_si@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    119c <main+0x1c>
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1070 <mpz_cmp_ui@plt>
cmp    $0x0,%rax
je     1222 <main+0xa2>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0xa,%edx
call   1050 <mpz_mod_ui@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xa,%esi
call   1080 <mpz_init_set_ui@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1090 <mpz_tdiv_q@plt>
jmp    11d1 <main+0x51>
mov    -0x4(%rbp),%esi
lea    0xdd4(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%esi
call   10a0 <mpz_init_set_si@plt>
mov    $0x2,%ebx
mov    %ebx,%edx
call   1030 <mpz_mul_si@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1190 <main+0x10>
call   1060 <mpz_init@plt>
xor    %ebx,%ebx
xor    %esi,%esi
call   1070 <mpz_cmp_ui@plt>
test   %rax,%rax
je     11e7 <main+0x67>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edx
call   1050 <mpz_mod_ui@plt>
add    %eax,%ebx
mov    $0xa,%esi
call   1080 <mpz_init_set_ui@plt>
call   1090 <mpz_tdiv_q@plt>
xor    %esi,%esi
call   1070 <mpz_cmp_ui@plt>
test   %rax,%rax
jne    11c0 <main+0x40>
lea    0xe12(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %2
%5 = call i32 @mpz_init_set_si(i32 %4, i32 1)
store i32 2, i32* %1
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %1
%8 = icmp sle i32 %7, 100
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = load i32, i32* %1
%13 = call i32 @mpz_mul_si(i32 %10, i32 %11, i32 %12)
br label %14
14: ; preds = %9
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %6
17: ; preds = %6
store i32 0, i32* %1
%18 = load i32, i32* %3
%19 = call i32 @mpz_init(i32 %18)
br label %20
20: ; preds = %24, %17
%21 = load i32, i32* %2
%22 = call i64 @mpz_cmp_ui(i32 %21, i32 0)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = call i64 @mpz_mod_ui(i32 %25, i32 %26, i32 10)
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = add nsw i64 %29, %27
%31 = trunc i64 %30 to i32
store i32 %31, i32* %1
%32 = load i32, i32* %3
%33 = call i32 @mpz_init_set_ui(i32 %32, i32 10)
%34 = load i32, i32* %2
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = call i32 @mpz_tdiv_q(i32 %34, i32 %35, i32 %36)
br label %20
38: ; preds = %20
%39 = load i32, i32* %1
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = tail call i32 @mpz_init_set_si(i32 undef, i32 1)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 2, %0 ], [ %5, %2 ]
%4 = tail call i32 @mpz_mul_si(i32 undef, i32 undef, i32 %3)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 101
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @mpz_init(i32 undef)
%9 = tail call i64 @mpz_cmp_ui(i32 undef, i32 0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %7, %11
%12 = phi i32 [ %15, %11 ], [ 0, %7 ]
%13 = tail call i64 @mpz_mod_ui(i32 undef, i32 undef, i32 10)
%14 = trunc i64 %13 to i32
%15 = add i32 %12, %14
%16 = tail call i32 @mpz_init_set_ui(i32 undef, i32 10)
%17 = tail call i32 @mpz_tdiv_q(i32 undef, i32 undef, i32 undef)
%18 = tail call i64 @mpz_cmp_ui(i32 undef, i32 0)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %11
20: ; preds = %11, %7
%21 = phi i32 [ 0, %7 ], [ %15, %11 ]
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
ret void
}