#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 */

/* Variables and functions */
double exp(double);
double pow(double const, int);
double tgamma(int);
double my_gamma_dist(double x) {
  enum {
    k = 9,
  };
  const double theta = 0.5;
  x *= 20.0;
  double pdf_x =
      1.0 / (tgamma(k) * pow(theta, k)) * pow(x, k - 1) * exp(-x / theta);
  return pdf_x;
}


x86 assembly (clang, -O0):
<my_gamma_dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebe(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x9,%edi
call   1030 <tgamma@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe8d(%rip),%xmm0
mov    $0x9,%edi
call   1050 <pow@plt>
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe7a(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x8,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe25(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_gamma_dist>:
sub    $0x18,%rsp
mulsd  0xec4(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x9,%edi
call   1030 <tgamma@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xeae(%rip),%xmm0
mov    $0x9,%edi
call   1050 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0xe9e(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x8,%edi
call   1050 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe72(%rip),%xmm0
call   1040 <exp@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @my_gamma_dist(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store double 5.000000e-01, double* %3
%5 = load double, double* %2
%6 = fmul double %5, 2.000000e+01
store double %6, double* %2
%7 = call double @tgamma(i32 9)
%8 = call double @pow(double 5.000000e-01, i32 9)
%9 = fmul double %7, %8
%10 = fdiv double 1.000000e+00, %9
%11 = load double, double* %2
%12 = call double @pow(double %11, i32 8)
%13 = fmul double %10, %12
%14 = load double, double* %2
%15 = fneg double %14
%16 = fdiv double %15, 5.000000e-01
%17 = call double @exp(double %16)
%18 = fmul double %13, %17
store double %18, double* %4
%19 = load double, double* %4
ret double %19
}

LLVM IR (-O2):
define double @my_gamma_dist(double %0) {
%2 = fmul double %0, 2.000000e+01
%3 = tail call double @tgamma(i32 9)
%4 = tail call double @pow(double 5.000000e-01, i32 9)
%5 = fmul double %3, %4
%6 = fdiv double 1.000000e+00, %5
%7 = tail call double @pow(double %2, i32 8)
%8 = fmul double %7, %6
%9 = fmul double %2, -2.000000e+00
%10 = tail call double @exp(double %9)
%11 = fmul double %10, %8
ret double %11
}