#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 /*<<< orphan*/ gmp_printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_cdiv_q(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ mpz_fac_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_pow_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int main(void) {
  mpz_t numerator, denominator, answer;
  mpz_init(numerator);
  mpz_init(denominator);
  mpz_init(answer);
  mpz_fac_ui(numerator, 40);
  mpz_fac_ui(denominator, 20);
  mpz_pow_ui(denominator, denominator, 2);
  mpz_cdiv_q(answer, numerator, denominator);
  gmp_printf("answer: %Zd\n", answer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <mpz_init@plt>
mov    -0xc(%rbp),%edi
call   1030 <mpz_init@plt>
mov    -0x10(%rbp),%edi
call   1030 <mpz_init@plt>
mov    -0x8(%rbp),%edi
mov    $0x28,%esi
call   1040 <mpz_fac_ui@plt>
mov    -0xc(%rbp),%edi
mov    $0x14,%esi
call   1040 <mpz_fac_ui@plt>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x2,%edx
call   1050 <mpz_pow_ui@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1070 <mpz_cdiv_q@plt>
mov    -0x10(%rbp),%esi
lea    0xe47(%rip),%rdi
call   1060 <gmp_printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <mpz_init@plt>
call   1030 <mpz_init@plt>
call   1030 <mpz_init@plt>
mov    $0x28,%esi
call   1040 <mpz_fac_ui@plt>
mov    $0x14,%esi
call   1040 <mpz_fac_ui@plt>
mov    $0x2,%edx
call   1050 <mpz_pow_ui@plt>
call   1070 <mpz_cdiv_q@plt>
lea    0xe76(%rip),%rdi
call   1060 <gmp_printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"answer: %Zd\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @mpz_init(i32 %5)
%7 = load i32, i32* %3
%8 = call i32 @mpz_init(i32 %7)
%9 = load i32, i32* %4
%10 = call i32 @mpz_init(i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @mpz_fac_ui(i32 %11, i32 40)
%13 = load i32, i32* %3
%14 = call i32 @mpz_fac_ui(i32 %13, i32 20)
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = call i32 @mpz_pow_ui(i32 %15, i32 %16, i32 2)
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @mpz_cdiv_q(i32 %18, i32 %19, i32 %20)
%22 = load i32, i32* %4
%23 = call i32 @gmp_printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"answer: %Zd\0A\00"
define i32 @main() {
%1 = tail call i32 @mpz_init(i32 undef)
%2 = tail call i32 @mpz_init(i32 undef)
%3 = tail call i32 @mpz_init(i32 undef)
%4 = tail call i32 @mpz_fac_ui(i32 undef, i32 40)
%5 = tail call i32 @mpz_fac_ui(i32 undef, i32 20)
%6 = tail call i32 @mpz_pow_ui(i32 undef, i32 undef, i32 2)
%7 = tail call i32 @mpz_cdiv_q(i32 undef, i32 undef, i32 undef)
%8 = tail call i32 @gmp_printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}