#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 */
char *mpz_get_str(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_mul_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  mpz_t product;
  mpz_init_set_ui(product, 1);
  for (int i = 1; i <= 100; ++i) {
    mpz_mul_ui(product, product, i);
  }
  int sum = 0;
  for (char *p = mpz_get_str(NULL, 10, product); *p; ++p) {
    sum += *p - '0';
  }
  printf("%d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1050 <mpz_init_set_ui@plt>
movl   $0x1,-0x18(%rbp)
cmpl   $0x64,-0x18(%rbp)
jg     1190 <main+0x50>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1060 <mpz_mul_ui@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116a <main+0x2a>
movl   $0x0,-0x1c(%rbp)
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xa,%esi
call   1040 <mpz_get_str@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     11da <main+0x9a>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11ac <main+0x6c>
mov    -0x1c(%rbp),%esi
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%ebx
mov    $0x1,%esi
call   1050 <mpz_init_set_ui@plt>
mov    %ebx,%edx
call   1060 <mpz_mul_ui@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1150 <main+0x10>
xor    %ebx,%ebx
xor    %edi,%edi
mov    $0xa,%esi
call   1040 <mpz_get_str@plt>
mov    (%rax),%cl
test   %cl,%cl
je     1193 <main+0x53>
add    $0x1,%rax
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %ecx,%ebx
add    $0xffffffd0,%ebx
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1180 <main+0x40>
lea    0xe66(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
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
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %6
%11 = call i32 @mpz_init_set_ui(i32 %10, i32 1)
store i32 1, i32* %7
br label %12
12: ; preds = %20, %2
%13 = load i32, i32* %7
%14 = icmp sle i32 %13, 100
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %6
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i32 @mpz_mul_ui(i32 %16, i32 %17, i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %12
23: ; preds = %12
store i32 0, i32* %8
%24 = load i32, i32* %6
%25 = call i8* @mpz_get_str(i32* null, i32 10, i32 %24)
store i8* %25, i8** %9
br label %26
26: ; preds = %37, %23
%27 = load i8*, i8** %9
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = load i8*, i8** %9
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = load i32, i32* %8
%36 = add nsw i32 %35, %34
store i32 %36, i32* %8
br label %37
37: ; preds = %30
%38 = load i8*, i8** %9
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %9
br label %26
40: ; preds = %26
%41 = load i32, i32* %8
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @mpz_init_set_ui(i32 undef, i32 1)
br label %8
4: ; preds = %8
%5 = tail call i8* @mpz_get_str(i32* null, i32 10, i32 undef)
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %16
8: ; preds = %2, %8
%9 = phi i32 [ 1, %2 ], [ %11, %8 ]
%10 = tail call i32 @mpz_mul_ui(i32 undef, i32 undef, i32 %9)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, 101
br i1 %12, label %4, label %8
13: ; preds = %16, %4
%14 = phi i32 [ 0, %4 ], [ %22, %16 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
16: ; preds = %4, %16
%17 = phi i8 [ %24, %16 ], [ %6, %4 ]
%18 = phi i8* [ %23, %16 ], [ %5, %4 ]
%19 = phi i32 [ %22, %16 ], [ 0, %4 ]
%20 = sext i8 %17 to i32
%21 = add i32 %19, -48
%22 = add i32 %21, %20
%23 = getelementptr inbounds i8, i8* %18, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %13, label %16
}