#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 fmax(double const, double const);
double fmin(double const, double const);
int /*<<< orphan*/ pvrs(double const *, double const *, double *, double *);
int /*<<< orphan*/ trrs(double const *, double const *, double **, double **);
int /*<<< orphan*/ tsrs(double const *, double const *, double *, double **);
void anrs(const double *WL, const double *WR, double *ps, double *us) {
  double pmax = fmax(WL[2], WR[2]);
  double pmin = fmin(WL[2], WR[2]);
  double Q = pmax / pmin;
  double pstar, ustar;
  pvrs(WL, WR, &pstar, &ustar);
  if ((Q < 2.0) && (pstar < pmax) && (pstar > pmin)) {
    *ps = pstar;
    *us = ustar;
  } else {
    if (pstar < pmin) {
      trrs(WL, WR, &ps, &us);
    } else {
      tsrs(WL, WR, &pstar, &us);
      *ps = pstar;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<anrs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
maxsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1050 <pvrs@plt>
movsd  0xe22(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    122c <anrs+0xfc>
movsd  -0x40(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    122c <anrs+0xfc>
movsd  -0x40(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    122c <anrs+0xfc>
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1281 <anrs+0x151>
movsd  -0x40(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    125a <anrs+0x12a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <trrs@plt>
jmp    127c <anrs+0x14c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1030 <tsrs@plt>
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1281 <anrs+0x151>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anrs>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rdx,0x18(%rsp)
mov    %rcx,0x8(%rsp)
movsd  0x10(%rdi),%xmm0
movsd  0x10(%rsi),%xmm3
movapd %xmm0,%xmm4
cmpunordsd %xmm0,%xmm4
movapd %xmm4,%xmm1
andpd  %xmm3,%xmm1
movapd %xmm3,%xmm2
maxsd  %xmm0,%xmm2
andnpd %xmm2,%xmm4
orpd   %xmm1,%xmm4
ucomisd %xmm0,%xmm0
jp     1186 <anrs+0x56>
minsd  %xmm0,%xmm3
movapd %xmm3,0x40(%rsp)
movapd %xmm4,%xmm0
divsd  %xmm3,%xmm0
movapd %xmm0,0x30(%rsp)
mov    %rsp,%rdx
lea    0x10(%rsp),%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
movapd %xmm4,0x20(%rsp)
call   1050 <pvrs@plt>
movapd 0x40(%rsp),%xmm1
movsd  0xe3f(%rip),%xmm0
ucomisd 0x30(%rsp),%xmm0
movsd  (%rsp),%xmm0
jbe    11f3 <anrs+0xc3>
movapd 0x20(%rsp),%xmm2
ucomisd %xmm0,%xmm2
jbe    11f3 <anrs+0xc3>
ucomisd %xmm1,%xmm0
jbe    11f3 <anrs+0xc3>
movsd  %xmm0,(%r14)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r12)
jmp    122d <anrs+0xfd>
ucomisd %xmm0,%xmm1
jbe    1210 <anrs+0xe0>
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <trrs@plt>
jmp    122d <anrs+0xfd>
mov    %rsp,%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <tsrs@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @anrs(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%14 = load double*, double** %5
%15 = getelementptr inbounds double, double* %14, i64 2
%16 = load double, double* %15
%17 = load double*, double** %6
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = call double @llvm.maxnum.f64(double %16, double %19)
store double %20, double* %9
%21 = load double*, double** %5
%22 = getelementptr inbounds double, double* %21, i64 2
%23 = load double, double* %22
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 2
%26 = load double, double* %25
%27 = call double @llvm.minnum.f64(double %23, double %26)
store double %27, double* %10
%28 = load double, double* %9
%29 = load double, double* %10
%30 = fdiv double %28, %29
store double %30, double* %11
%31 = load double*, double** %5
%32 = load double*, double** %6
%33 = call i32 @pvrs(double* %31, double* %32, double* %12, double* %13)
%34 = load double, double* %11
%35 = fcmp olt double %34, 2.000000e+00
br i1 %35, label %36, label %49
36: ; preds = %4
%37 = load double, double* %12
%38 = load double, double* %9
%39 = fcmp olt double %37, %38
br i1 %39, label %40, label %49
40: ; preds = %36
%41 = load double, double* %12
%42 = load double, double* %10
%43 = fcmp ogt double %41, %42
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = load double, double* %12
%46 = load double*, double** %7
store double %45, double* %46
%47 = load double, double* %13
%48 = load double*, double** %8
store double %47, double* %48
br label %64
49: ; preds = %40, %36, %4
%50 = load double, double* %12
%51 = load double, double* %10
%52 = fcmp olt double %50, %51
br i1 %52, label %53, label %57
53: ; preds = %49
%54 = load double*, double** %5
%55 = load double*, double** %6
%56 = call i32 @trrs(double* %54, double* %55, double** %7, double** %8)
br label %63
57: ; preds = %49
%58 = load double*, double** %5
%59 = load double*, double** %6
%60 = call i32 @tsrs(double* %58, double* %59, double* %12, double** %8)
%61 = load double, double* %12
%62 = load double*, double** %7
store double %61, double* %62
br label %63
63: ; preds = %57, %53
br label %64
64: ; preds = %63, %44
ret void
}

LLVM IR (-O2):
define void @anrs(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
store double* %2, double** %5
store double* %3, double** %6
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = load double, double* %11
%13 = tail call double @llvm.maxnum.f64(double %10, double %12)
%14 = tail call double @llvm.minnum.f64(double %10, double %12)
%15 = fdiv double %13, %14
%16 = bitcast double* %7 to i8*
%17 = bitcast double* %8 to i8*
%18 = call i32 @pvrs(double* %0, double* %1, double* %7, double* %8)
%19 = fcmp olt double %15, 2.000000e+00
%20 = load double, double* %7
br i1 %19, label %21, label %27
21: ; preds = %4
%22 = fcmp olt double %20, %13
%23 = fcmp ogt double %20, %14
%24 = select i1 %22, i1 %23, i1 false
br i1 %24, label %25, label %27
25: ; preds = %21
store double %20, double* %2
%26 = load double, double* %8
store double %26, double* %3
br label %34
27: ; preds = %4, %21
%28 = fcmp olt double %20, %14
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = call i32 @trrs(double* %0, double* %1, double** %5, double** %6)
br label %34
31: ; preds = %27
%32 = call i32 @tsrs(double* %0, double* %1, double* %7, double** %6)
%33 = load double, double* %7
store double %33, double* %2
br label %34
34: ; preds = %29, %31, %25
ret void
}