#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 *);
int /*<<< orphan*/ vel(double, double, double, double, double *, double *);
int STflowSphere_Vy(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 eR[3], eTHETA[3];
  double norm_v, theta, r;
  double vR, vTHETA;
  for (i = 0; i < nPoints; i++) {
    coords(vx, vy, vz, xS, yS, zS, &x[i * 3], &r, &theta, &norm_v, eR, eTHETA);
    vel(rS, norm_v, r, theta, &vR, &vTHETA);
    u[i] = vR * eR[1] + vTHETA * eTHETA[1];
  }
  return 0;
}


x86 assembly (clang, -O0):
<STflowSphere_Vy>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%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)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1281 <STflowSphere_Vy+0x161>
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  -0x58(%rbp),%xmm0
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xc8(%rbp),%xmm2
ff
movsd  -0xc0(%rbp),%xmm3
ff
lea    -0xd0(%rbp),%rdi
lea    -0xd8(%rbp),%rsi
call   1040 <vel@plt>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0xd8(%rbp),%xmm1
ff
mulsd  -0xa8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ab <STflowSphere_Vy+0x8b>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STflowSphere_Vy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
test   %edx,%edx
jle    1240 <STflowSphere_Vy+0x120>
mov    %r8,%r14
mov    %rcx,%rbx
movsd  (%rsi),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rsi),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsi),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsi),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x30(%rsi),%xmm0
movsd  %xmm0,(%rsp)
mov    %edx,%ebp
xor    %r15d,%r15d
lea    0x40(%rsp),%r12
lea    0x38(%rsp),%r13
nopl   0x0(%rax)
movsd  0x30(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  (%rsp),%xmm5
mov    %rbx,%rdi
lea    0x48(%rsp),%rsi
lea    0x50(%rsp),%rdx
lea    0x58(%rsp),%rcx
lea    0x80(%rsp),%r8
lea    0x60(%rsp),%r9
call   1030 <coords@plt>
movsd  0x58(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
movsd  0x50(%rsp),%xmm3
movsd  0x18(%rsp),%xmm0
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <vel@plt>
movsd  0x38(%rsp),%xmm0
mulsd  0x68(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
mulsd  0x88(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%r15,8)
add    $0x1,%r15
add    $0x18,%rbx
cmp    %r15,%rbp
jne    11a0 <STflowSphere_Vy+0x80>
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_Vy(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 [3 x double]
%22 = alloca [3 x double]
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = 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
%28 = load double*, double** %8
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
store double %30, double* %14
%31 = load double*, double** %8
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
store double %33, double* %15
%34 = load double*, double** %8
%35 = getelementptr inbounds double, double* %34, i64 2
%36 = load double, double* %35
store double %36, double* %16
%37 = load double*, double** %8
%38 = getelementptr inbounds double, double* %37, i64 3
%39 = load double, double* %38
store double %39, double* %17
%40 = load double*, double** %8
%41 = getelementptr inbounds double, double* %40, i64 4
%42 = load double, double* %41
store double %42, double* %18
%43 = load double*, double** %8
%44 = getelementptr inbounds double, double* %43, i64 5
%45 = load double, double* %44
store double %45, double* %19
%46 = load double*, double** %8
%47 = getelementptr inbounds double, double* %46, i64 6
%48 = load double, double* %47
store double %48, double* %20
store i32 0, i32* %13
br label %49
49: ; preds = %85, %6
%50 = load i32, i32* %13
%51 = load i32, i32* %9
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %88
53: ; preds = %49
%54 = load double, double* %14
%55 = load double, double* %15
%56 = load double, double* %16
%57 = load double, double* %18
%58 = load double, double* %19
%59 = load double, double* %20
%60 = load double*, double** %11
%61 = load i32, i32* %13
%62 = mul nsw i32 %61, 3
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %60, i64 %63
%65 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 0
%66 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%67 = call i32 @coords(double %54, double %55, double %56, double %57, double %58, double %59, double* %64, double* %25, double* %24, double* %23, double* %65, double* %66)
%68 = load double, double* %17
%69 = load double, double* %23
%70 = load double, double* %25
%71 = load double, double* %24
%72 = call i32 @vel(double %68, double %69, double %70, double %71, double* %26, double* %27)
%73 = load double, double* %26
%74 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 1
%75 = load double, double* %74
%76 = load double, double* %27
%77 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%78 = load double, double* %77
%79 = fmul double %76, %78
%80 = call double @llvm.fmuladd.f64(double %73, double %75, double %79)
%81 = load double*, double** %12
%82 = load i32, i32* %13
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %81, i64 %83
store double %80, double* %84
br label %85
85: ; preds = %53
%86 = load i32, i32* %13
%87 = add nsw i32 %86, 1
store i32 %87, i32* %13
br label %49
88: ; preds = %49
ret i32 0
}

LLVM IR (-O2):
define i32 @STflowSphere_Vy(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 = alloca double
%13 = alloca double
%14 = load double, double* %1
%15 = getelementptr inbounds double, double* %1, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %1, i64 2
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %1, i64 3
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %1, i64 4
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %1, i64 5
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %1, i64 6
%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 = bitcast double* %12 to i8*
%33 = bitcast double* %13 to i8*
%34 = icmp sgt i32 %2, 0
br i1 %34, label %35, label %59
35: ; preds = %6
%36 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%37 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%38 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
%39 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 1
%40 = zext i32 %2 to i64
br label %41
41: ; preds = %35, %41
%42 = phi i64 [ 0, %35 ], [ %57, %41 ]
%43 = mul nuw nsw i64 %42, 3
%44 = getelementptr inbounds double, double* %4, i64 %43
%45 = call i32 @coords(double %14, double %16, double %18, double %22, double %24, double %26, double* %44, double* %11, double* %10, double* %9, double* %36, double* %37)
%46 = load double, double* %9
%47 = load double, double* %11
%48 = load double, double* %10
%49 = call i32 @vel(double %20, double %46, double %47, double %48, double* %12, double* %13)
%50 = load double, double* %12
%51 = load double, double* %38
%52 = load double, double* %13
%53 = load double, double* %39
%54 = fmul double %52, %53
%55 = call double @llvm.fmuladd.f64(double %50, double %51, double %54)
%56 = getelementptr inbounds double, double* %5, i64 %42
store double %55, double* %56
%57 = add nuw nsw i64 %42, 1
%58 = icmp eq i64 %57, %40
br i1 %58, label %59, label %41
59: ; preds = %41, %6
ret i32 0
}