#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 */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ compute_U(int, int, int, int, double *, double *);
double fabs(double);
double hypot(double, double);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double prec = 1e-12;
  double res_x_check, res_y_check;
  double res_x, res_y;
  res_x_check = 0.416940305395154;
  compute_U(12, 20, 3., 0., &res_x, &res_y);
  printf("%e\n", fabs(res_x - res_x_check));
  assert(fabs(res_x - res_x_check) < prec);
  res_x_check = -0.00646612339420241;
  res_y_check = 0.0112751987320501;
  compute_U(12, 20, 3., 2., &res_x, &res_y);
  printf("%e\n", hypot(res_x - res_x_check, res_y - res_y_check));
  assert(hypot(res_x - res_x_check, res_y - res_y_check) < prec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0xc,%edi
mov    $0x14,%esi
mov    $0x3,%edx
xor    %ecx,%ecx
lea    -0x28(%rbp),%r8
lea    -0x30(%rbp),%r9
call   1040 <compute_U@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xe88(%rip),%xmm1
pand   %xmm1,%xmm0
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movaps 0xe67(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsd  0xe2d(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe18(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0xc,%edi
mov    $0x14,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
lea    -0x28(%rbp),%r8
lea    -0x30(%rbp),%r9
call   1040 <compute_U@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
call   1060 <hypot@plt>
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
call   1060 <hypot@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rbx
lea    0x8(%rsp),%r14
mov    $0xc,%edi
mov    $0x14,%esi
mov    $0x3,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %r14,%r9
call   1040 <compute_U@plt>
movsd  0xe8b(%rip),%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
andpd  0xe9a(%rip),%xmm0
lea    0xea3(%rip),%r15
mov    %r15,%rdi
call   1030 <printf@plt>
movsd  0xe63(%rip),%xmm0
addsd  (%rsp),%xmm0
andpd  0xe76(%rip),%xmm0
movapd %xmm0,%xmm1
movsd  0xe52(%rip),%xmm0
xor    %edi,%edi
ucomisd %xmm1,%xmm0
seta   %dil
call   1050 <assert@plt>
mov    $0xc,%edi
mov    $0x14,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
mov    %rbx,%r8
mov    %r14,%r9
call   1040 <compute_U@plt>
movsd  (%rsp),%xmm0
addsd  0xe1f(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  0xe19(%rip),%xmm1
call   1060 <hypot@plt>
mov    %r15,%rdi
call   1030 <printf@plt>
movsd  0xdfc(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  0xdf7(%rip),%xmm1
addsd  0x8(%rsp),%xmm1
call   1060 <hypot@plt>
xor    %edi,%edi
movsd  0xdd2(%rip),%xmm1
ucomisd %xmm0,%xmm1
seta   %dil
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store double 0x3D719799812DEA11, double* %2
store double 0x3FDAAF2664039CB1, double* %3
%7 = call i32 @compute_U(i32 12, i32 20, i32 3, i32 0, double* %5, double* %6)
%8 = load double, double* %5
%9 = load double, double* %3
%10 = fsub double %8, %9
%11 = call double @llvm.fabs.f64(double %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %11)
%13 = load double, double* %5
%14 = load double, double* %3
%15 = fsub double %13, %14
%16 = call double @llvm.fabs.f64(double %15)
%17 = load double, double* %2
%18 = fcmp olt double %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
store double 0xBF7A7C38C828F59F, double* %3
store double 0x3F8717738E7AFE8F, double* %4
%21 = call i32 @compute_U(i32 12, i32 20, i32 3, i32 2, double* %5, double* %6)
%22 = load double, double* %5
%23 = load double, double* %3
%24 = fsub double %22, %23
%25 = load double, double* %6
%26 = load double, double* %4
%27 = fsub double %25, %26
%28 = call double @hypot(double %24, double %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %28)
%30 = load double, double* %5
%31 = load double, double* %3
%32 = fsub double %30, %31
%33 = load double, double* %6
%34 = load double, double* %4
%35 = fsub double %33, %34
%36 = call double @hypot(double %32, double %35)
%37 = load double, double* %2
%38 = fcmp olt double %36, %37
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%e\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @compute_U(i32 12, i32 20, i32 3, i32 0, double* %1, double* %2)
%6 = load double, double* %1
%7 = fadd double %6, 0xBFDAAF2664039CB1
%8 = call double @llvm.fabs.f64(double %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %8)
%10 = load double, double* %1
%11 = fadd double %10, 0xBFDAAF2664039CB1
%12 = call double @llvm.fabs.f64(double %11)
%13 = fcmp olt double %12, 0x3D719799812DEA11
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @compute_U(i32 12, i32 20, i32 3, i32 2, double* %1, double* %2)
%17 = load double, double* %1
%18 = fadd double %17, 0x3F7A7C38C828F59F
%19 = load double, double* %2
%20 = fadd double %19, 0xBF8717738E7AFE8F
%21 = call double @hypot(double %18, double %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %21)
%23 = load double, double* %1
%24 = fadd double %23, 0x3F7A7C38C828F59F
%25 = load double, double* %2
%26 = fadd double %25, 0xBF8717738E7AFE8F
%27 = call double @hypot(double %24, double %26)
%28 = fcmp olt double %27, 0x3D719799812DEA11
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
ret i32 0
}