#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*/ solve2sym(double *, double *, double *);
char *test_solve2sym() {
  double A[3] = {0.59, 1.34, 0.86};
  double RHS[4] = {-1.21, 1.91, -0.82, 0.03};
  double Xtrue[4] = {-64.0, 42.5, -22.05098039, 14.1745098};
  double X[4];
  solve2sym(X, A, RHS);
  do {
    if (!(fabs(X[0] - Xtrue[0]) < 1e-8))
      return "solve2sym(X, A, RHS)[0] not right";
  } while (0);
  do {
    if (!(fabs(X[1] - Xtrue[1]) < 1e-8))
      return "solve2sym(X, A, RHS)[1] not right";
  } while (0);
  do {
    if (!(fabs(X[2] - Xtrue[2]) < 1e-8))
      return "solve2sym(X, A, RHS)[2] not right";
  } while (0);
  do {
    if (!(fabs(X[3] - Xtrue[3]) < 1e-8))
      return "solve2sym(X, A, RHS)[3] not right";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_solve2sym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x80(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1040 <solve2sym@plt>
movsd  -0x80(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe30(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     11ea <test_solve2sym+0xca>
lea    0xe8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12b4 <test_solve2sym+0x194>
jmp    11ef <test_solve2sym+0xcf>
jmp    11f4 <test_solve2sym+0xd4>
movsd  -0x78(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdf1(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1229 <test_solve2sym+0x109>
lea    0xe72(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12b4 <test_solve2sym+0x194>
jmp    122e <test_solve2sym+0x10e>
jmp    1233 <test_solve2sym+0x113>
movsd  -0x70(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdb2(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1268 <test_solve2sym+0x148>
lea    0xe55(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12b4 <test_solve2sym+0x194>
jmp    126d <test_solve2sym+0x14d>
jmp    1272 <test_solve2sym+0x152>
movsd  -0x68(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xd73(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     12a7 <test_solve2sym+0x187>
lea    0xe38(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12b4 <test_solve2sym+0x194>
jmp    12ac <test_solve2sym+0x18c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_solve2sym>:
sub    $0x68,%rsp
mov    0xf05(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf0d(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xef1(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
lea    0x40(%rsp),%rdx
call   1040 <solve2sym@plt>
movsd  (%rsp),%xmm0
addsd  0xe8d(%rip),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jle    1188 <test_solve2sym+0x68>
lea    0xedd(%rip),%rax
add    $0x68,%rsp
ret
movsd  0x8(%rsp),%xmm0
addsd  0xe72(%rip),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jle    11ab <test_solve2sym+0x8b>
lea    0xedc(%rip),%rax
add    $0x68,%rsp
ret
movsd  0x10(%rsp),%xmm0
addsd  0xe57(%rip),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jle    11ce <test_solve2sym+0xae>
lea    0xedb(%rip),%rax
add    $0x68,%rsp
ret
movsd  0x18(%rsp),%xmm0
addsd  0xe3c(%rip),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
lea    0xed8(%rip),%rcx
cmovg  %rcx,%rax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.test_solve2sym.A = [3 x double] [double 5.900000e-01, double 1.340000e+00, double 8.600000e-01]
@__const.test_solve2sym.RHS = [4 x double] [double -1.210000e+00, double 1.910000e+00, double -8.200000e-01, double 3.000000e-02]
@__const.test_solve2sym.Xtrue = [4 x double] [double -6.400000e+01, double 4.250000e+01, double 0xC0360D0D0D03C98E, double 0x402C59595937A9BA]
@.str = [34 x i8] c"solve2sym(X, A, RHS)[0] not right\00"
@.str.1 = [34 x i8] c"solve2sym(X, A, RHS)[1] not right\00"
@.str.2 = [34 x i8] c"solve2sym(X, A, RHS)[2] not right\00"
@.str.3 = [34 x i8] c"solve2sym(X, A, RHS)[3] not right\00"
define i8* @test_solve2sym() {
%1 = alloca i8*
%2 = alloca [3 x double]
%3 = alloca [4 x double]
%4 = alloca [4 x double]
%5 = alloca [4 x double]
%6 = bitcast [3 x double]* %2 to i8*
%7 = bitcast [4 x double]* %3 to i8*
%8 = bitcast [4 x double]* %4 to i8*
%9 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%10 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%11 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
%12 = call i32 @solve2sym(double* %9, double* %10, double* %11)
br label %13
13: ; preds = %0
%14 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%15 = load double, double* %14
%16 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 0
%17 = load double, double* %16
%18 = fsub double %15, %17
%19 = call i32 @fabs(double %18)
%20 = sitofp i32 %19 to double
%21 = fcmp olt double %20, 1.000000e-08
br i1 %21, label %23, label %22
22: ; preds = %13
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8** %1
br label %61
23: ; preds = %13
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
%26 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 1
%27 = load double, double* %26
%28 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 1
%29 = load double, double* %28
%30 = fsub double %27, %29
%31 = call i32 @fabs(double %30)
%32 = sitofp i32 %31 to double
%33 = fcmp olt double %32, 1.000000e-08
br i1 %33, label %35, label %34
34: ; preds = %25
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %61
35: ; preds = %25
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
%38 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 2
%39 = load double, double* %38
%40 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 2
%41 = load double, double* %40
%42 = fsub double %39, %41
%43 = call i32 @fabs(double %42)
%44 = sitofp i32 %43 to double
%45 = fcmp olt double %44, 1.000000e-08
br i1 %45, label %47, label %46
46: ; preds = %37
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %61
47: ; preds = %37
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
%50 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 3
%51 = load double, double* %50
%52 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 3
%53 = load double, double* %52
%54 = fsub double %51, %53
%55 = call i32 @fabs(double %54)
%56 = sitofp i32 %55 to double
%57 = fcmp olt double %56, 1.000000e-08
br i1 %57, label %59, label %58
58: ; preds = %49
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %61
59: ; preds = %49
br label %60
60: ; preds = %59
store i8* null, i8** %1
br label %61
61: ; preds = %60, %58, %46, %34, %22
%62 = load i8*, i8** %1
ret i8* %62
}

LLVM IR (-O2):
@__const.test_solve2sym.A = [3 x double] [double 5.900000e-01, double 1.340000e+00, double 8.600000e-01]
@__const.test_solve2sym.RHS = [4 x double] [double -1.210000e+00, double 1.910000e+00, double -8.200000e-01, double 3.000000e-02]
@.str = [34 x i8] c"solve2sym(X, A, RHS)[0] not right\00"
@.str.1 = [34 x i8] c"solve2sym(X, A, RHS)[1] not right\00"
@.str.2 = [34 x i8] c"solve2sym(X, A, RHS)[2] not right\00"
@.str.3 = [34 x i8] c"solve2sym(X, A, RHS)[3] not right\00"
define i8* @test_solve2sym() {
%1 = alloca [3 x double]
%2 = alloca [4 x double]
%3 = alloca [4 x double]
%4 = bitcast [3 x double]* %1 to i8*
%5 = bitcast [4 x double]* %2 to i8*
%6 = bitcast [4 x double]* %3 to i8*
%7 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 0
%8 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%9 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%10 = call i32 @solve2sym(double* %7, double* %8, double* %9)
%11 = load double, double* %7
%12 = fadd double %11, 6.400000e+01
%13 = call i32 @fabs(double %12)
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %34
15: ; preds = %0
%16 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 1
%17 = load double, double* %16
%18 = fadd double %17, -4.250000e+01
%19 = call i32 @fabs(double %18)
%20 = icmp slt i32 %19, 1
br i1 %20, label %21, label %34
21: ; preds = %15
%22 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 2
%23 = load double, double* %22
%24 = fadd double %23, 0x40360D0D0D03C98E
%25 = call i32 @fabs(double %24)
%26 = icmp slt i32 %25, 1
br i1 %26, label %27, label %34
27: ; preds = %21
%28 = getelementptr inbounds [4 x double], [4 x double]* %3, i64 0, i64 3
%29 = load double, double* %28
%30 = fadd double %29, 0xC02C59595937A9BA
%31 = call i32 @fabs(double %30)
%32 = icmp slt i32 %31, 1
%33 = select i1 %32, i8* null, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0)
br label %34
34: ; preds = %27, %21, %15, %0
%35 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), %15 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), %21 ], [ %33, %27 ]
ret i8* %35
}