#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 fabs(double);
int /*<<< orphan*/ pdot2sym(double *, double *, double *, int);
char *test_pdot2() {
  double x[] = {0.95, 0.9, 0.16, 0.46, 0.86, 0.29};
  double y[] = {0.9695, 0.6678, 0.277, 0.1908, 1.108, 0.7632};
  double dot_true[] = {1.918225, 0.910116, 1.32129};
  double dot[3];
  pdot2sym(dot, x, y, 3);
  do {
    if (!(fabs(dot[0] - dot_true[0]) < 1e-8))
      return "pdot2sym(x, y, 3)[0] not right";
  } while (0);
  do {
    if (!(fabs(dot[1] - dot_true[1]) < 1e-8))
      return "pdot2sym(x, y, 3)[1] not right";
  } while (0);
  do {
    if (!(fabs(dot[2] - dot_true[2]) < 1e-8))
      return "pdot2sym(x, y, 3)[2] not right";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_pdot2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movsd  0xf05(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xef0(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movsd  0xe77(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe62(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe4d(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe38(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe23(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe0e(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0xe72(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xe6c(%rip),%rax
mov    %rax,-0x88(%rbp)
mov    0xe66(%rip),%rax
mov    %rax,-0x80(%rbp)
lea    -0xb0(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x70(%rbp),%rdx
mov    $0x3,%ecx
call   1040 <pdot2sym@plt>
movsd  -0xb0(%rbp),%xmm0
ff
subsd  -0x90(%rbp),%xmm0
ff
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe08(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1272 <test_pdot2+0x142>
lea    0xe1f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1306 <test_pdot2+0x1d6>
jmp    1277 <test_pdot2+0x147>
jmp    127c <test_pdot2+0x14c>
movsd  -0xa8(%rbp),%xmm0
ff
subsd  -0x88(%rbp),%xmm0
ff
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdc3(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     12b7 <test_pdot2+0x187>
lea    0xdf9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1306 <test_pdot2+0x1d6>
jmp    12bc <test_pdot2+0x18c>
jmp    12c1 <test_pdot2+0x191>
movsd  -0xa0(%rbp),%xmm0
ff
subsd  -0x80(%rbp),%xmm0
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xd81(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     12f9 <test_pdot2+0x1c9>
lea    0xdd6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1306 <test_pdot2+0x1d6>
jmp    12fe <test_pdot2+0x1ce>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pdot2>:
sub    $0x88,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    %rsp,%rdi
lea    0x50(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    $0x3,%ecx
call   1030 <pdot2sym@plt>
movsd  (%rsp),%xmm0
addsd  0xecd(%rip),%xmm0
call   1040 <fabs@plt>
test   %eax,%eax
jle    11ab <test_pdot2+0x8b>
lea    0xed5(%rip),%rax
add    $0x88,%rsp
ret
movsd  0x8(%rsp),%xmm0
addsd  0xeaf(%rip),%xmm0
call   1040 <fabs@plt>
test   %eax,%eax
jle    11d1 <test_pdot2+0xb1>
lea    0xece(%rip),%rax
add    $0x88,%rsp
ret
movsd  0x10(%rsp),%xmm0
addsd  0xe91(%rip),%xmm0
call   1040 <fabs@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
lea    0xec5(%rip),%rcx
cmovg  %rcx,%rax
add    $0x88,%rsp
ret

LLVM IR (-O0):
@__const.test_pdot2.dot_true = [3 x double] [double 0x3FFEB10CB295E9E2, double 9.101160e-01, double 1.321290e+00]
@.str = [31 x i8] c"pdot2sym(x, y, 3)[0] not right\00"
@.str.1 = [31 x i8] c"pdot2sym(x, y, 3)[1] not right\00"
@.str.2 = [31 x i8] c"pdot2sym(x, y, 3)[2] not right\00"
define i8* @test_pdot2() {
%1 = alloca i8*
%2 = alloca [6 x double]
%3 = alloca [6 x double]
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = bitcast [6 x double]* %2 to i8*
%7 = bitcast i8* %6 to [6 x double]*
%8 = getelementptr inbounds [6 x double], [6 x double]* %7, i32 0, i32 0
store double 0x3FEE666666666666, double* %8
%9 = getelementptr inbounds [6 x double], [6 x double]* %7, i32 0, i32 1
store double 9.000000e-01, double* %9
%10 = getelementptr inbounds [6 x double], [6 x double]* %7, i32 0, i32 2
store double 1.600000e-01, double* %10
%11 = getelementptr inbounds [6 x double], [6 x double]* %7, i32 0, i32 3
store double 4.600000e-01, double* %11
%12 = getelementptr inbounds [6 x double], [6 x double]* %7, i32 0, i32 4
store double 8.600000e-01, double* %12
%13 = getelementptr inbounds [6 x double], [6 x double]* %7, i32 0, i32 5
store double 2.900000e-01, double* %13
%14 = bitcast [6 x double]* %3 to i8*
%15 = bitcast i8* %14 to [6 x double]*
%16 = getelementptr inbounds [6 x double], [6 x double]* %15, i32 0, i32 0
store double 9.695000e-01, double* %16
%17 = getelementptr inbounds [6 x double], [6 x double]* %15, i32 0, i32 1
store double 0x3FE55E9E1B089A02, double* %17
%18 = getelementptr inbounds [6 x double], [6 x double]* %15, i32 0, i32 2
store double 2.770000e-01, double* %18
%19 = getelementptr inbounds [6 x double], [6 x double]* %15, i32 0, i32 3
store double 1.908000e-01, double* %19
%20 = getelementptr inbounds [6 x double], [6 x double]* %15, i32 0, i32 4
store double 1.108000e+00, double* %20
%21 = getelementptr inbounds [6 x double], [6 x double]* %15, i32 0, i32 5
store double 7.632000e-01, double* %21
%22 = bitcast [3 x double]* %4 to i8*
%23 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%24 = getelementptr inbounds [6 x double], [6 x double]* %2, i64 0, i64 0
%25 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%26 = call i32 @pdot2sym(double* %23, double* %24, double* %25, i32 3)
br label %27
27: ; preds = %0
%28 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%29 = load double, double* %28
%30 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%31 = load double, double* %30
%32 = fsub double %29, %31
%33 = call i32 @fabs(double %32)
%34 = sitofp i32 %33 to double
%35 = fcmp olt double %34, 1.000000e-08
br i1 %35, label %37, label %36
36: ; preds = %27
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8** %1
br label %63
37: ; preds = %27
br label %38
38: ; preds = %37
br label %39
39: ; preds = %38
%40 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%41 = load double, double* %40
%42 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%43 = load double, double* %42
%44 = fsub double %41, %43
%45 = call i32 @fabs(double %44)
%46 = sitofp i32 %45 to double
%47 = fcmp olt double %46, 1.000000e-08
br i1 %47, label %49, label %48
48: ; preds = %39
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %63
49: ; preds = %39
br label %50
50: ; preds = %49
br label %51
51: ; preds = %50
%52 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%53 = load double, double* %52
%54 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%55 = load double, double* %54
%56 = fsub double %53, %55
%57 = call i32 @fabs(double %56)
%58 = sitofp i32 %57 to double
%59 = fcmp olt double %58, 1.000000e-08
br i1 %59, label %61, label %60
60: ; preds = %51
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %63
61: ; preds = %51
br label %62
62: ; preds = %61
store i8* null, i8** %1
br label %63
63: ; preds = %62, %60, %48, %36
%64 = load i8*, i8** %1
ret i8* %64
}

LLVM IR (-O2):
@.str = [31 x i8] c"pdot2sym(x, y, 3)[0] not right\00"
@.str.1 = [31 x i8] c"pdot2sym(x, y, 3)[1] not right\00"
@.str.2 = [31 x i8] c"pdot2sym(x, y, 3)[2] not right\00"
define i8* @test_pdot2() {
%1 = alloca [6 x double]
%2 = alloca [6 x double]
%3 = alloca [3 x double]
%4 = bitcast [6 x double]* %1 to i8*
%5 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 0
%6 = bitcast [6 x double]* %1 to <2 x double>*
store <2 x double> <double 0x3FEE666666666666, double 9.000000e-01>, <2 x double>* %6
%7 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 2
%8 = bitcast double* %7 to <2 x double>*
store <2 x double> <double 1.600000e-01, double 4.600000e-01>, <2 x double>* %8
%9 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 4
%10 = bitcast double* %9 to <2 x double>*
store <2 x double> <double 8.600000e-01, double 2.900000e-01>, <2 x double>* %10
%11 = bitcast [6 x double]* %2 to i8*
%12 = getelementptr inbounds [6 x double], [6 x double]* %2, i64 0, i64 0
%13 = bitcast [6 x double]* %2 to <2 x double>*
store <2 x double> <double 9.695000e-01, double 0x3FE55E9E1B089A02>, <2 x double>* %13
%14 = getelementptr inbounds [6 x double], [6 x double]* %2, i64 0, i64 2
%15 = bitcast double* %14 to <2 x double>*
store <2 x double> <double 2.770000e-01, double 1.908000e-01>, <2 x double>* %15
%16 = getelementptr inbounds [6 x double], [6 x double]* %2, i64 0, i64 4
%17 = bitcast double* %16 to <2 x double>*
store <2 x double> <double 1.108000e+00, double 7.632000e-01>, <2 x double>* %17
%18 = bitcast [3 x double]* %3 to i8*
%19 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%20 = call i32 @pdot2sym(double* %19, double* %5, double* %12, i32 3)
%21 = load double, double* %19
%22 = fadd double %21, 0xBFFEB10CB295E9E2
%23 = call i32 @fabs(double %22)
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %38
25: ; preds = %0
%26 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
%27 = load double, double* %26
%28 = fadd double %27, -9.101160e-01
%29 = call i32 @fabs(double %28)
%30 = icmp slt i32 %29, 1
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%33 = load double, double* %32
%34 = fadd double %33, -1.321290e+00
%35 = call i32 @fabs(double %34)
%36 = icmp slt i32 %35, 1
%37 = select i1 %36, i8* null, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0)
br label %38
38: ; preds = %31, %25, %0
%39 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), %25 ], [ %37, %31 ]
ret i8* %39
}