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

/* Variables and functions */
int /*<<< orphan*/ mpz_fac_ui(int /*<<< orphan*/, int);
scalar_t__ mpz_fdiv_q_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
scalar_t__ mpz_sgn(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  mpz_t n;
  uint64_t sum = 0;
  mpz_init(n);
  mpz_fac_ui(n, 100);
  while (mpz_sgn(n) != 0) {
    sum += mpz_fdiv_q_ui(n, n, 10);
  }
  printf("%lld\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <mpz_init@plt>
mov    -0x14(%rbp),%edi
mov    $0x64,%esi
call   1050 <mpz_fac_ui@plt>
mov    -0x14(%rbp),%edi
call   1070 <mpz_sgn@plt>
cmp    $0x0,%rax
je     11b6 <main+0x66>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0xa,%edx
call   1060 <mpz_fdiv_q_ui@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
jmp    1182 <main+0x32>
mov    -0x18(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1040 <mpz_init@plt>
mov    $0x64,%esi
call   1050 <mpz_fac_ui@plt>
call   1070 <mpz_sgn@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1186 <main+0x36>
nopl   0x0(%rax)
mov    $0xa,%edx
call   1060 <mpz_fdiv_q_ui@plt>
add    %eax,%ebx
call   1070 <mpz_sgn@plt>
test   %rax,%rax
jne    1170 <main+0x20>
lea    0xe73(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%lld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %6
%9 = call i32 @mpz_init(i32 %8)
%10 = load i32, i32* %6
%11 = call i32 @mpz_fac_ui(i32 %10, i32 100)
br label %12
12: ; preds = %16, %2
%13 = load i32, i32* %6
%14 = call i64 @mpz_sgn(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %6
%18 = load i32, i32* %6
%19 = call i64 @mpz_fdiv_q_ui(i32 %17, i32 %18, i32 10)
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = add nsw i64 %21, %19
%23 = trunc i64 %22 to i32
store i32 %23, i32* %7
br label %12
24: ; preds = %12
%25 = load i32, i32* %7
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%lld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @mpz_init(i32 undef)
%4 = tail call i32 @mpz_fac_ui(i32 undef, i32 100)
%5 = tail call i64 @mpz_sgn(i32 undef)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %11, %7 ], [ 0, %2 ]
%9 = tail call i64 @mpz_fdiv_q_ui(i32 undef, i32 undef, i32 10)
%10 = trunc i64 %9 to i32
%11 = add i32 %8, %10
%12 = tail call i64 @mpz_sgn(i32 undef)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %2
%15 = phi i32 [ 0, %2 ], [ %11, %7 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}