#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 fabs(double);
double pt(double, int);
double sqrt(double);
int mdest2(int n1, int n2, double xbar1, double xbar2, double v1, double v2,
           double g, double *xl, double *xu) {
  double xb, w;
  if (n1 < 1 || n2 < 1 || g <= 0.0 || g >= 1.0)
    return 999;
  xb = fabs(xbar1 - xbar2);
  w = pt(1.0 - g, n1 + n2 - 2) * sqrt(1.0 / (double)n1 + 1.0 / (double)n2) *
      sqrt(((double)n1 * v1 + (double)n2 * v2) / (double)(n1 + n2 - 2));
  *xl = xb - w;
  *xu = xb + w;
  return 0;
}


x86 assembly (clang, -O0):
<mdest2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     1188 <mdest2+0x68>
cmpl   $0x1,-0xc(%rbp)
jl     1188 <mdest2+0x68>
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jae    1188 <mdest2+0x68>
movsd  -0x38(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1194 <mdest2+0x74>
movl   $0x3e7,-0x4(%rbp)
jmp    1278 <mdest2+0x158>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movaps 0xe6b(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe4a(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%edi
add    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <pt@plt>
movsd  %xmm0,-0x68(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe25(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm2
movsd  0xe14(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
cvtsi2sdl -0xc(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdest2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
ucomisd 0xecc(%rip),%xmm4
mov    $0x3e7,%eax
jae    127a <mdest2+0x15a>
mov    %edi,%ebp
test   %edi,%edi
jle    127a <mdest2+0x15a>
mov    %esi,%ebx
test   %esi,%esi
jle    127a <mdest2+0x15a>
xorpd  %xmm5,%xmm5
ucomisd %xmm4,%xmm5
jae    127a <mdest2+0x15a>
mov    %rcx,%r14
mov    %rdx,%r15
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x18(%rsp)
subsd  %xmm1,%xmm0
andpd  0xe91(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
movsd  0xe73(%rip),%xmm0
subsd  %xmm4,%xmm0
lea    (%rbx,%rbp,1),%r12d
add    $0xfffffffe,%r12d
mov    %r12d,%edi
call   1030 <pt@plt>
xorps  %xmm4,%xmm4
cvtsi2sd %ebp,%xmm4
movapd %xmm0,%xmm3
movsd  0xe4c(%rip),%xmm1
movapd %xmm1,%xmm0
divsd  %xmm4,%xmm0
xorps  %xmm5,%xmm5
cvtsi2sd %ebx,%xmm5
divsd  %xmm5,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ucomisd 0xe31(%rip),%xmm1
jb     11df <mdest2+0xbf>
sqrtsd %xmm0,%xmm0
jmp    1208 <mdest2+0xe8>
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x28(%rsp)
movsd  %xmm5,0x20(%rsp)
call   1040 <sqrt@plt>
movsd  0x20(%rsp),%xmm5
movsd  0x28(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm5
mulsd  %xmm1,%xmm4
addsd  %xmm5,%xmm4
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
divsd  %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jb     1243 <mdest2+0x123>
xorps  %xmm0,%xmm0
sqrtsd %xmm4,%xmm0
jmp    1258 <mdest2+0x138>
movapd %xmm4,%xmm0
movsd  %xmm3,0x8(%rsp)
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
mulsd  %xmm0,%xmm3
movapd 0x30(%rsp),%xmm1
movapd %xmm1,%xmm0
subsd  %xmm3,%xmm0
movsd  %xmm0,(%r15)
addsd  %xmm1,%xmm3
movsd  %xmm3,(%r14)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mdest2(i32 %0, i32 %1, double %2, double %3, double %4, double %5, double %6, double* %7, double* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double*
%19 = alloca double*
%20 = alloca double
%21 = alloca double
store i32 %0, i32* %11
store i32 %1, i32* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double* %7, double** %18
store double* %8, double** %19
%22 = load i32, i32* %11
%23 = icmp slt i32 %22, 1
br i1 %23, label %33, label %24
24: ; preds = %9
%25 = load i32, i32* %12
%26 = icmp slt i32 %25, 1
br i1 %26, label %33, label %27
27: ; preds = %24
%28 = load double, double* %17
%29 = fcmp ole double %28, 0.000000e+00
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = load double, double* %17
%32 = fcmp oge double %31, 1.000000e+00
br i1 %32, label %33, label %34
33: ; preds = %30, %27, %24, %9
store i32 999, i32* %10
br label %79
34: ; preds = %30
%35 = load double, double* %13
%36 = load double, double* %14
%37 = fsub double %35, %36
%38 = call double @llvm.fabs.f64(double %37)
store double %38, double* %20
%39 = load double, double* %17
%40 = fsub double 1.000000e+00, %39
%41 = load i32, i32* %11
%42 = load i32, i32* %12
%43 = add nsw i32 %41, %42
%44 = sub nsw i32 %43, 2
%45 = call double @pt(double %40, i32 %44)
%46 = load i32, i32* %11
%47 = sitofp i32 %46 to double
%48 = fdiv double 1.000000e+00, %47
%49 = load i32, i32* %12
%50 = sitofp i32 %49 to double
%51 = fdiv double 1.000000e+00, %50
%52 = fadd double %48, %51
%53 = call double @sqrt(double %52)
%54 = fmul double %45, %53
%55 = load i32, i32* %11
%56 = sitofp i32 %55 to double
%57 = load double, double* %15
%58 = load i32, i32* %12
%59 = sitofp i32 %58 to double
%60 = load double, double* %16
%61 = fmul double %59, %60
%62 = call double @llvm.fmuladd.f64(double %56, double %57, double %61)
%63 = load i32, i32* %11
%64 = load i32, i32* %12
%65 = add nsw i32 %63, %64
%66 = sub nsw i32 %65, 2
%67 = sitofp i32 %66 to double
%68 = fdiv double %62, %67
%69 = call double @sqrt(double %68)
%70 = fmul double %54, %69
store double %70, double* %21
%71 = load double, double* %20
%72 = load double, double* %21
%73 = fsub double %71, %72
%74 = load double*, double** %18
store double %73, double* %74
%75 = load double, double* %20
%76 = load double, double* %21
%77 = fadd double %75, %76
%78 = load double*, double** %19
store double %77, double* %78
store i32 0, i32* %10
br label %79
79: ; preds = %34, %33
%80 = load i32, i32* %10
ret i32 %80
}

LLVM IR (-O2):
define i32 @mdest2(i32 %0, i32 %1, double %2, double %3, double %4, double %5, double %6, double* nocapture writeonly %7, double* nocapture writeonly %8) {
%10 = icmp slt i32 %0, 1
%11 = icmp slt i32 %1, 1
%12 = or i1 %10, %11
%13 = fcmp ole double %6, 0.000000e+00
%14 = or i1 %12, %13
%15 = fcmp oge double %6, 1.000000e+00
%16 = or i1 %15, %14
br i1 %16, label %39, label %17
17: ; preds = %9
%18 = fsub double %2, %3
%19 = tail call double @llvm.fabs.f64(double %18)
%20 = fsub double 1.000000e+00, %6
%21 = add nsw i32 %0, -2
%22 = add i32 %21, %1
%23 = tail call double @pt(double %20, i32 %22)
%24 = sitofp i32 %0 to double
%25 = fdiv double 1.000000e+00, %24
%26 = sitofp i32 %1 to double
%27 = fdiv double 1.000000e+00, %26
%28 = fadd double %25, %27
%29 = tail call double @sqrt(double %28)
%30 = fmul double %23, %29
%31 = fmul double %26, %5
%32 = tail call double @llvm.fmuladd.f64(double %24, double %4, double %31)
%33 = sitofp i32 %22 to double
%34 = fdiv double %32, %33
%35 = tail call double @sqrt(double %34)
%36 = fmul double %30, %35
%37 = fsub double %19, %36
store double %37, double* %7
%38 = fadd double %19, %36
store double %38, double* %8
br label %39
39: ; preds = %9, %17
%40 = phi i32 [ 0, %17 ], [ 999, %9 ]
ret i32 %40
}