#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 scalar_t__ epsilon;

/* Variables and functions */
double dble_sum(double *, int);
double rand_gamma(int, double);
void update_alpha_U(double *U, double *alpha_U, double epsilon, int K, int N) {
  int a = (int)(epsilon) + N * K / 2;
  int b = 0.5 * dble_sum(U, N * K) + epsilon;
  *alpha_U = rand_gamma(a, 1.0 / b);
}


x86 assembly (clang, -O0):
<update_alpha_U>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
imul   -0x1c(%rbp),%esi
call   1030 <dble_sum@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe8f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
cvtsi2sdl -0x28(%rbp),%xmm1
movsd  0xe68(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1040 <rand_gamma@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_alpha_U>:
push   %rbp
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsi,%rbx
cvttsd2si %xmm0,%eax
imul   %ecx,%edx
mov    %edx,%ebp
shr    $0x1f,%ebp
add    %edx,%ebp
sar    %ebp
add    %eax,%ebp
mov    %edx,%esi
call   1030 <dble_sum@plt>
mulsd  0xeb4(%rip),%xmm0
addsd  (%rsp),%xmm0
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm1
movsd  0xea7(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    %ebp,%edi
call   1040 <rand_gamma@plt>
movsd  %xmm0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @update_alpha_U(double* %0, double* %1, double %2, i32 %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store double %2, double* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load double, double* %8
%14 = fptosi double %13 to i32
%15 = load i32, i32* %10
%16 = load i32, i32* %9
%17 = mul nsw i32 %15, %16
%18 = sdiv i32 %17, 2
%19 = add nsw i32 %14, %18
store i32 %19, i32* %11
%20 = load double*, double** %6
%21 = load i32, i32* %10
%22 = load i32, i32* %9
%23 = mul nsw i32 %21, %22
%24 = call double @dble_sum(double* %20, i32 %23)
%25 = load double, double* %8
%26 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %24, double %25)
%27 = fptosi double %26 to i32
store i32 %27, i32* %12
%28 = load i32, i32* %11
%29 = load i32, i32* %12
%30 = sitofp i32 %29 to double
%31 = fdiv double 1.000000e+00, %30
%32 = call double @rand_gamma(i32 %28, double %31)
%33 = load double*, double** %7
store double %32, double* %33
ret void
}

LLVM IR (-O2):
define void @update_alpha_U(double* %0, double* nocapture writeonly %1, double %2, i32 %3, i32 %4) {
%6 = fptosi double %2 to i32
%7 = mul nsw i32 %4, %3
%8 = sdiv i32 %7, 2
%9 = add nsw i32 %8, %6
%10 = tail call double @dble_sum(double* %0, i32 %7)
%11 = tail call double @llvm.fmuladd.f64(double %10, double 5.000000e-01, double %2)
%12 = fptosi double %11 to i32
%13 = sitofp i32 %12 to double
%14 = fdiv double 1.000000e+00, %13
%15 = tail call double @rand_gamma(i32 %9, double %14)
store double %15, double* %1
ret void
}