#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 econv(int);
int /*<<< orphan*/ mpz_addmul_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
scalar_t__ mpz_cmp_ui(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_set(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ mpz_tdiv_q_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, unsigned long);
int main(void) {
  mpz_t p, q, t;
  mpz_init(t);
  mpz_init_set_ui(p, 1);
  mpz_init_set_ui(q, econv(100));
  int i;
  for (i = 100 - 1; i > 1; --i) {
    mpz_set(t, p);
    mpz_addmul_ui(t, q, econv(i));
    mpz_set(p, q);
    mpz_set(q, t);
  }
  mpz_addmul_ui(p, q, 2);
  unsigned long sum = 0;
  while (mpz_cmp_ui(p, 0))
    sum += mpz_tdiv_q_ui(p, p, 10);
  printf("%lu\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%edi
call   1080 <mpz_init@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   10a0 <mpz_init_set_ui@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x64,%edi
call   1030 <econv@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   10a0 <mpz_init_set_ui@plt>
movl   $0x63,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jle    121f <main+0x9f>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <mpz_set@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <econv@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    %eax,%edx
call   1050 <mpz_addmul_ui@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <mpz_set@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <mpz_set@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11c5 <main+0x45>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x2,%edx
call   1050 <mpz_addmul_ui@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1090 <mpz_cmp_ui@plt>
cmp    $0x0,%rax
je     1268 <main+0xe8>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0xa,%edx
call   1040 <mpz_tdiv_q_ui@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1237 <main+0xb7>
mov    -0x20(%rbp),%rsi
lea    0xd8d(%rip),%rdi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1080 <mpz_init@plt>
mov    $0x1,%esi
call   10a0 <mpz_init_set_ui@plt>
mov    $0x64,%ebx
mov    $0x64,%edi
call   1030 <econv@plt>
mov    %eax,%esi
call   10a0 <mpz_init_set_ui@plt>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%ebx
call   1060 <mpz_set@plt>
mov    %ebx,%edi
call   1030 <econv@plt>
mov    %eax,%edx
call   1050 <mpz_addmul_ui@plt>
call   1060 <mpz_set@plt>
call   1060 <mpz_set@plt>
cmp    $0x2,%ebx
ja     11b0 <main+0x30>
mov    $0x2,%edx
call   1050 <mpz_addmul_ui@plt>
xor    %ebx,%ebx
xor    %esi,%esi
call   1090 <mpz_cmp_ui@plt>
test   %rax,%rax
je     1209 <main+0x89>
xor    %ebx,%ebx
nop
mov    $0xa,%edx
call   1040 <mpz_tdiv_q_ui@plt>
add    %rax,%rbx
xor    %esi,%esi
call   1090 <mpz_cmp_ui@plt>
test   %rax,%rax
jne    11f0 <main+0x70>
lea    0xdf0(%rip),%rdi
mov    %rbx,%rsi
call   1070 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 0, i32* %1
%7 = load i32, i32* %4
%8 = call i32 @mpz_init(i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @mpz_init_set_ui(i32 %9, i32 1)
%11 = load i32, i32* %3
%12 = call i32 @econv(i32 100)
%13 = call i32 @mpz_init_set_ui(i32 %11, i32 %12)
store i32 99, i32* %5
br label %14
14: ; preds = %32, %0
%15 = load i32, i32* %5
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %35
17: ; preds = %14
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = call i32 @mpz_set(i32 %18, i32 %19)
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = call i32 @econv(i32 %23)
%25 = call i32 @mpz_addmul_ui(i32 %21, i32 %22, i32 %24)
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = call i32 @mpz_set(i32 %26, i32 %27)
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = call i32 @mpz_set(i32 %29, i32 %30)
br label %32
32: ; preds = %17
%33 = load i32, i32* %5
%34 = add nsw i32 %33, -1
store i32 %34, i32* %5
br label %14
35: ; preds = %14
%36 = load i32, i32* %2
%37 = load i32, i32* %3
%38 = call i32 @mpz_addmul_ui(i32 %36, i32 %37, i32 2)
store i64 0, i64* %6
br label %39
39: ; preds = %43, %35
%40 = load i32, i32* %2
%41 = call i64 @mpz_cmp_ui(i32 %40, i32 0)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %39
%44 = load i32, i32* %2
%45 = load i32, i32* %2
%46 = call i64 @mpz_tdiv_q_ui(i32 %44, i32 %45, i32 10)
%47 = load i64, i64* %6
%48 = add i64 %47, %46
store i64 %48, i64* %6
br label %39
49: ; preds = %39
%50 = load i64, i64* %6
%51 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = tail call i32 @mpz_init(i32 undef)
%2 = tail call i32 @mpz_init_set_ui(i32 undef, i32 1)
%3 = tail call i32 @econv(i32 100)
%4 = tail call i32 @mpz_init_set_ui(i32 undef, i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 99, %0 ], [ %12, %5 ]
%7 = tail call i32 @mpz_set(i32 undef, i32 undef)
%8 = tail call i32 @econv(i32 %6)
%9 = tail call i32 @mpz_addmul_ui(i32 undef, i32 undef, i32 %8)
%10 = tail call i32 @mpz_set(i32 undef, i32 undef)
%11 = tail call i32 @mpz_set(i32 undef, i32 undef)
%12 = add nsw i32 %6, -1
%13 = icmp ugt i32 %6, 2
br i1 %13, label %5, label %14
14: ; preds = %5
%15 = tail call i32 @mpz_addmul_ui(i32 undef, i32 undef, i32 2)
%16 = tail call i64 @mpz_cmp_ui(i32 undef, i32 0)
%17 = icmp eq i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %14, %18
%19 = phi i64 [ %21, %18 ], [ 0, %14 ]
%20 = tail call i64 @mpz_tdiv_q_ui(i32 undef, i32 undef, i32 10)
%21 = add i64 %20, %19
%22 = tail call i64 @mpz_cmp_ui(i32 undef, i32 0)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %18
24: ; preds = %18, %14
%25 = phi i64 [ 0, %14 ], [ %21, %18 ]
%26 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %25)
ret i32 0
}