#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 _p3dHuangYagerThresholding_Ux(int, int, int, int);
scalar_t__ sqrt(double);
double _p3dHuangYagerThresholding_yager(int u0, int u1, int t) {
  int i;
  double x, sum = 0.0;
  for (i = 0; i < 256; i++) {
    x = _p3dHuangYagerThresholding_Ux(i, u0, u1, t);
    x = x * (1.0 - x);
    sum += x * x;
  }
  x = (double)sqrt((double)sum);
  return x;
}


x86 assembly (clang, -O0):
<_p3dHuangYagerThresholding_yager>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x100,-0x10(%rbp)
jge    11a8 <_p3dHuangYagerThresholding_yager+0x88>
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1030 <_p3dHuangYagerThresholding_Ux@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe90(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1140 <_p3dHuangYagerThresholding_yager+0x20>
movsd  -0x20(%rbp),%xmm0
call   1040 <sqrt@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_p3dHuangYagerThresholding_yager>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1030 <_p3dHuangYagerThresholding_Ux@plt>
movsd  0xea4(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    1140 <_p3dHuangYagerThresholding_yager+0x20>
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @_p3dHuangYagerThresholding_yager(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %9
store i32 0, i32* %7
br label %10
10: ; preds = %27, %3
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 256
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call double @_p3dHuangYagerThresholding_Ux(i32 %14, i32 %15, i32 %16, i32 %17)
store double %18, double* %8
%19 = load double, double* %8
%20 = load double, double* %8
%21 = fsub double 1.000000e+00, %20
%22 = fmul double %19, %21
store double %22, double* %8
%23 = load double, double* %8
%24 = load double, double* %8
%25 = load double, double* %9
%26 = call double @llvm.fmuladd.f64(double %23, double %24, double %25)
store double %26, double* %9
br label %27
27: ; preds = %13
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %10
30: ; preds = %10
%31 = load double, double* %9
%32 = call i64 @sqrt(double %31)
%33 = sitofp i64 %32 to double
store double %33, double* %8
%34 = load double, double* %8
ret double %34
}

LLVM IR (-O2):
define double @_p3dHuangYagerThresholding_yager(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %3, %4
%5 = phi double [ 0.000000e+00, %3 ], [ %10, %4 ]
%6 = phi i32 [ 0, %3 ], [ %11, %4 ]
%7 = tail call double @_p3dHuangYagerThresholding_Ux(i32 %6, i32 %0, i32 %1, i32 %2)
%8 = fsub double 1.000000e+00, %7
%9 = fmul double %7, %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %5)
%11 = add nuw nsw i32 %6, 1
%12 = icmp eq i32 %11, 256
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = tail call i64 @sqrt(double %10)
%15 = sitofp i64 %14 to double
ret double %15
}