#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 sqrt(int);
void polar_electron(double Ep, double Er, double Ee, double mu, double *ce,
                    double *cr) {
  const double tmp = mu / Er;
  const double pr = Er * sqrt(1. - tmp * tmp);
  *ce = 1. - 0.5 * (pr + Ep - Ee) * (pr + Ee - Ep) / (Ep * Ee);
  if (*ce < -1.)
    *ce = -1.;
  else if (*ce > 1.)
    *ce = 1.;
  *cr = 1. - 0.5 * (Ee + Ep - pr) * (Ee - pr + Ep) / (Ep * pr);
  if (*cr < -1.)
    *cr = -1.;
  else if (*cr > 1.)
    *cr = 1.;
}


x86 assembly (clang, -O0):
<polar_electron>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe8e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xe61(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe2c(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xe0c(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    1213 <polar_electron+0x103>
mov    -0x28(%rbp),%rax
movsd  0xdf6(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    1242 <polar_electron+0x132>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xde5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    123d <polar_electron+0x12d>
mov    -0x28(%rbp),%rax
movsd  0xdcf(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    1242 <polar_electron+0x132>
movsd  -0x18(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  0xdb7(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd82(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xd62(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    12bd <polar_electron+0x1ad>
mov    -0x30(%rbp),%rax
movsd  0xd4c(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    12ec <polar_electron+0x1dc>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd3b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12e7 <polar_electron+0x1d7>
mov    -0x30(%rbp),%rax
movsd  0xd25(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    12ec <polar_electron+0x1dc>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polar_electron>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
divsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm3
movsd  0xec2(%rip),%xmm0
subsd  %xmm3,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movsd  0xead(%rip),%xmm5
movsd  (%rsp),%xmm4
movsd  0x10(%rsp),%xmm3
mulsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm2
addsd  %xmm4,%xmm2
subsd  %xmm3,%xmm2
mulsd  0xe90(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  %xmm3,%xmm1
subsd  %xmm4,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm4,%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm5,%xmm1
movsd  %xmm1,(%rbx)
movsd  0xe6c(%rip),%xmm2
ucomisd %xmm1,%xmm2
ja     11b4 <polar_electron+0xa4>
ucomisd %xmm5,%xmm1
movapd %xmm5,%xmm2
jbe    11b8 <polar_electron+0xa8>
movsd  %xmm2,(%rbx)
movapd %xmm4,%xmm1
addsd  %xmm3,%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe3c(%rip),%xmm1
subsd  %xmm0,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm4,%xmm0
divsd  %xmm0,%xmm3
addsd  0xe18(%rip),%xmm3
movsd  %xmm3,(%r14)
movsd  0xe1b(%rip),%xmm0
ucomisd %xmm3,%xmm0
ja     1209 <polar_electron+0xf9>
movsd  0xdfd(%rip),%xmm0
ucomisd %xmm0,%xmm3
jbe    120e <polar_electron+0xfe>
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @polar_electron(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fdiv double %3, %1
%8 = fneg double %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %7, double 1.000000e+00)
%10 = fptosi double %9 to i32
%11 = tail call double @sqrt(i32 %10)
%12 = fmul double %11, %1
%13 = fadd double %12, %0
%14 = fsub double %13, %2
%15 = fmul double %14, 5.000000e-01
%16 = fadd double %12, %2
%17 = fsub double %16, %0
%18 = fmul double %17, %15
%19 = fmul double %0, %2
%20 = fdiv double %18, %19
%21 = fsub double 1.000000e+00, %20
store double %21, double* %4
%22 = fcmp olt double %21, -1.000000e+00
br i1 %22, label %25, label %23
23: ; preds = %6
%24 = fcmp ogt double %21, 1.000000e+00
br i1 %24, label %25, label %27
25: ; preds = %23, %6
%26 = phi double [ -1.000000e+00, %6 ], [ 1.000000e+00, %23 ]
store double %26, double* %4
br label %27
27: ; preds = %25, %23
%28 = fadd double %0, %2
%29 = fsub double %28, %12
%30 = fmul double %29, 5.000000e-01
%31 = fsub double %2, %12
%32 = fadd double %31, %0
%33 = fmul double %30, %32
%34 = fmul double %12, %0
%35 = fdiv double %33, %34
%36 = fsub double 1.000000e+00, %35
store double %36, double* %5
%37 = fcmp olt double %36, -1.000000e+00
br i1 %37, label %40, label %38
38: ; preds = %27
%39 = fcmp ogt double %36, 1.000000e+00
br i1 %39, label %40, label %42
40: ; preds = %38, %27
%41 = phi double [ -1.000000e+00, %27 ], [ 1.000000e+00, %38 ]
store double %41, double* %5
br label %42
42: ; preds = %40, %38
ret void
}