#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 */
int EXIT_SUCCESS;
int /*<<< orphan*/ gmp_printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_div_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                              unsigned long);
int /*<<< orphan*/ mpz_fac_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mod_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
scalar_t__ mpz_sgn(int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  mpz_t result;
  mpz_t sum;
  mpz_t aux;
  mpz_init(result);
  mpz_init(sum);
  mpz_init(aux);
  mpz_fac_ui(result, 100);
  while (mpz_sgn(result) > 0) {
    mpz_mod_ui(aux, result, 10);
    mpz_add(sum, sum, aux);
    mpz_div_ui(result, result, (unsigned long int)10);
  }
  gmp_printf("%Zd\n", sum);
  mpz_clear(sum);
  mpz_clear(aux);
  mpz_clear(result);
  return EXIT_SUCCESS;
}


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)
mov    -0x14(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x18(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x1c(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x14(%rbp),%edi
mov    $0x64,%esi
call   1070 <mpz_fac_ui@plt>
mov    -0x14(%rbp),%edi
call   10a0 <mpz_sgn@plt>
cmp    $0x0,%rax
jle    1200 <main+0x80>
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0xa,%edx
call   1040 <mpz_mod_ui@plt>
mov    -0x18(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1060 <mpz_add@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0xa,%edx
call   1030 <mpz_div_ui@plt>
jmp    11bb <main+0x3b>
mov    -0x18(%rbp),%esi
lea    0xdf6(%rip),%rdi
call   1090 <gmp_printf@plt>
mov    -0x18(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x1c(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x14(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1050 <mpz_init@plt>
call   1050 <mpz_init@plt>
call   1050 <mpz_init@plt>
mov    $0x64,%esi
call   1070 <mpz_fac_ui@plt>
nopw   0x0(%rax,%rax,1)
call   10a0 <mpz_sgn@plt>
test   %rax,%rax
jle    11c5 <main+0x45>
mov    $0xa,%edx
call   1040 <mpz_mod_ui@plt>
call   1060 <mpz_add@plt>
mov    $0xa,%edx
call   1030 <mpz_div_ui@plt>
jmp    11a0 <main+0x20>
lea    0xe34(%rip),%rdi
call   1090 <gmp_printf@plt>
call   1080 <mpz_clear@plt>
call   1080 <mpz_clear@plt>
call   1080 <mpz_clear@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%Zd\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %6
%10 = call i32 @mpz_init(i32 %9)
%11 = load i32, i32* %7
%12 = call i32 @mpz_init(i32 %11)
%13 = load i32, i32* %8
%14 = call i32 @mpz_init(i32 %13)
%15 = load i32, i32* %6
%16 = call i32 @mpz_fac_ui(i32 %15, i32 100)
br label %17
17: ; preds = %21, %2
%18 = load i32, i32* %6
%19 = call i64 @mpz_sgn(i32 %18)
%20 = icmp sgt i64 %19, 0
br i1 %20, label %21, label %32
21: ; preds = %17
%22 = load i32, i32* %8
%23 = load i32, i32* %6
%24 = call i32 @mpz_mod_ui(i32 %22, i32 %23, i32 10)
%25 = load i32, i32* %7
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = call i32 @mpz_add(i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %6
%30 = load i32, i32* %6
%31 = call i32 @mpz_div_ui(i32 %29, i32 %30, i64 10)
br label %17
32: ; preds = %17
%33 = load i32, i32* %7
%34 = call i32 @gmp_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %7
%36 = call i32 @mpz_clear(i32 %35)
%37 = load i32, i32* %8
%38 = call i32 @mpz_clear(i32 %37)
%39 = load i32, i32* %6
%40 = call i32 @mpz_clear(i32 %39)
%41 = load i32, i32* @EXIT_SUCCESS
ret i32 %41
}

LLVM IR (-O2):
@.str = [5 x i8] c"%Zd\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @mpz_init(i32 undef)
%4 = tail call i32 @mpz_init(i32 undef)
%5 = tail call i32 @mpz_init(i32 undef)
%6 = tail call i32 @mpz_fac_ui(i32 undef, i32 100)
%7 = tail call i64 @mpz_sgn(i32 undef)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2, %9
%10 = tail call i32 @mpz_mod_ui(i32 undef, i32 undef, i32 10)
%11 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%12 = tail call i32 @mpz_div_ui(i32 undef, i32 undef, i64 10)
%13 = tail call i64 @mpz_sgn(i32 undef)
%14 = icmp sgt i64 %13, 0
br i1 %14, label %9, label %15
15: ; preds = %9, %2
%16 = tail call i32 @gmp_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 undef)
%17 = tail call i32 @mpz_clear(i32 undef)
%18 = tail call i32 @mpz_clear(i32 undef)
%19 = tail call i32 @mpz_clear(i32 undef)
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}