#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*/ coords(double, double, double, double, double, double,
                          double *, double *, double *, double *, double *,
                          double *);
double cos(double);
int STflowSphere_P(int *iwork, double *rwork, int nPoints, double t, double *x,
                   double *u) {
  int i;
  double vx = rwork[0], vy = rwork[1], vz = rwork[2];
  double rS = rwork[3], xS = rwork[4], yS = rwork[5], zS = rwork[6];
  double mu = rwork[7];
  double eR[3], eTHETA[3];
  double norm_v, theta, r;
  for (i = 0; i < nPoints; i++) {
    coords(vx, vy, vz, xS, yS, zS, &x[i * 3], &r, &theta, &norm_v, eR, eTHETA);
    if (r >= rS)
      u[i] = (-3.0 * rS * mu * norm_v * cos(theta)) / (2.0 * r * r);
    else
      u[i] = 0.0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<STflowSphere_P>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12be <STflowSphere_P+0x19e>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm3
movsd  -0x68(%rbp),%xmm4
movsd  -0x70(%rbp),%xmm5
mov    -0x28(%rbp),%rdi
imul   $0x3,-0x34(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
lea    -0x90(%rbp),%r8
lea    -0xb0(%rbp),%r9
lea    -0xc8(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0xb8(%rbp),%rcx
call   1030 <coords@plt>
movsd  -0xc8(%rbp),%xmm0
ff
ucomisd -0x58(%rbp),%xmm0
jb     129b <STflowSphere_P+0x17b>
movsd  0xdd1(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  0xd8b(%rip),%xmm1
mulsd  -0xc8(%rbp),%xmm1
ff
mulsd  -0xc8(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12ab <STflowSphere_P+0x18b>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    12b0 <STflowSphere_P+0x190>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b9 <STflowSphere_P+0x99>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STflowSphere_P>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
test   %edx,%edx
jle    1264 <STflowSphere_P+0x144>
mov    %r8,%r14
mov    %rcx,%rbx
movsd  (%rsi),%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x18(%rsi),%xmm0
movsd  0x20(%rsi),%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x28(%rsi),%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0xe7e(%rip),%xmm1
movsd  %xmm0,0x30(%rsp)
mulsd  %xmm0,%xmm1
mulsd  0x38(%rsi),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x30(%rsi),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %edx,%r12d
xor    %r13d,%r13d
lea    0x80(%rsp),%rbp
lea    0x60(%rsp),%r15
jmp    11d7 <STflowSphere_P+0xb7>
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%r14,%r13,8)
add    $0x1,%r13
add    $0x18,%rbx
cmp    %r13,%r12
je     1264 <STflowSphere_P+0x144>
movsd  0x48(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
mov    %rbx,%rdi
mov    %rsp,%rsi
lea    0x50(%rsp),%rdx
lea    0x58(%rsp),%rcx
mov    %rbp,%r8
mov    %r15,%r9
call   1030 <coords@plt>
movsd  (%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd 0x30(%rsp),%xmm1
jb     11c0 <STflowSphere_P+0xa0>
movsd  0x58(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x50(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
jmp    11c0 <STflowSphere_P+0xa0>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @STflowSphere_P(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca [3 x double]
%23 = alloca [3 x double]
%24 = alloca double
%25 = alloca double
%26 = alloca double
store i32* %0, i32** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%27 = load double*, double** %8
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
store double %29, double* %14
%30 = load double*, double** %8
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
store double %32, double* %15
%33 = load double*, double** %8
%34 = getelementptr inbounds double, double* %33, i64 2
%35 = load double, double* %34
store double %35, double* %16
%36 = load double*, double** %8
%37 = getelementptr inbounds double, double* %36, i64 3
%38 = load double, double* %37
store double %38, double* %17
%39 = load double*, double** %8
%40 = getelementptr inbounds double, double* %39, i64 4
%41 = load double, double* %40
store double %41, double* %18
%42 = load double*, double** %8
%43 = getelementptr inbounds double, double* %42, i64 5
%44 = load double, double* %43
store double %44, double* %19
%45 = load double*, double** %8
%46 = getelementptr inbounds double, double* %45, i64 6
%47 = load double, double* %46
store double %47, double* %20
%48 = load double*, double** %8
%49 = getelementptr inbounds double, double* %48, i64 7
%50 = load double, double* %49
store double %50, double* %21
store i32 0, i32* %13
br label %51
51: ; preds = %98, %6
%52 = load i32, i32* %13
%53 = load i32, i32* %9
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %101
55: ; preds = %51
%56 = load double, double* %14
%57 = load double, double* %15
%58 = load double, double* %16
%59 = load double, double* %18
%60 = load double, double* %19
%61 = load double, double* %20
%62 = load double*, double** %11
%63 = load i32, i32* %13
%64 = mul nsw i32 %63, 3
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %62, i64 %65
%67 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%68 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 0
%69 = call i32 @coords(double %56, double %57, double %58, double %59, double %60, double %61, double* %66, double* %26, double* %25, double* %24, double* %67, double* %68)
%70 = load double, double* %26
%71 = load double, double* %17
%72 = fcmp oge double %70, %71
br i1 %72, label %73, label %92
73: ; preds = %55
%74 = load double, double* %17
%75 = fmul double -3.000000e+00, %74
%76 = load double, double* %21
%77 = fmul double %75, %76
%78 = load double, double* %24
%79 = fmul double %77, %78
%80 = load double, double* %25
%81 = call double @cos(double %80)
%82 = fmul double %79, %81
%83 = load double, double* %26
%84 = fmul double 2.000000e+00, %83
%85 = load double, double* %26
%86 = fmul double %84, %85
%87 = fdiv double %82, %86
%88 = load double*, double** %12
%89 = load i32, i32* %13
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %88, i64 %90
store double %87, double* %91
br label %97
92: ; preds = %55
%93 = load double*, double** %12
%94 = load i32, i32* %13
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
store double 0.000000e+00, double* %96
br label %97
97: ; preds = %92, %73
br label %98
98: ; preds = %97
%99 = load i32, i32* %13
%100 = add nsw i32 %99, 1
store i32 %100, i32* %13
br label %51
101: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
define i32 @STflowSphere_P(i32* nocapture readnone %0, double* nocapture %1, i32 %2, double %3, double* %4, double* nocapture writeonly %5) {
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = load double, double* %1
%13 = getelementptr inbounds double, double* %1, i64 1
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %1, i64 3
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %1, i64 4
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %1, i64 5
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %1, i64 6
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %1, i64 7
%26 = load double, double* %25
%27 = bitcast [3 x double]* %7 to i8*
%28 = bitcast [3 x double]* %8 to i8*
%29 = bitcast double* %9 to i8*
%30 = bitcast double* %10 to i8*
%31 = bitcast double* %11 to i8*
%32 = icmp sgt i32 %2, 0
br i1 %32, label %33, label %61
33: ; preds = %6
%34 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%35 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%36 = fmul double %18, -3.000000e+00
%37 = fmul double %36, %26
%38 = zext i32 %2 to i64
br label %39
39: ; preds = %33, %56
%40 = phi i64 [ 0, %33 ], [ %59, %56 ]
%41 = mul nuw nsw i64 %40, 3
%42 = getelementptr inbounds double, double* %4, i64 %41
%43 = call i32 @coords(double %12, double %14, double %16, double %20, double %22, double %24, double* %42, double* %11, double* %10, double* %9, double* %34, double* %35)
%44 = load double, double* %11
%45 = fcmp ult double %44, %18
br i1 %45, label %56, label %46
46: ; preds = %39
%47 = load double, double* %9
%48 = fmul double %37, %47
%49 = load double, double* %10
%50 = call double @cos(double %49)
%51 = fmul double %48, %50
%52 = load double, double* %11
%53 = fmul double %52, 2.000000e+00
%54 = fmul double %52, %53
%55 = fdiv double %51, %54
br label %56
56: ; preds = %39, %46
%57 = phi double [ %55, %46 ], [ 0.000000e+00, %39 ]
%58 = getelementptr inbounds double, double* %5, i64 %40
store double %57, double* %58
%59 = add nuw nsw i64 %40, 1
%60 = icmp eq i64 %59, %38
br i1 %60, label %61, label %39
61: ; preds = %56, %6
ret i32 0
}