#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 */
double cos(double);
double pow(double, double);
double sin(double);
void vel(double rS, double norm_v, double r, double theta, double *vR,
         double *vTHETA) {
  if (r > rS) {
    *vR = norm_v * cos(theta) *
          (1.0 - (3.0 * rS / (2.0 * r)) + (pow(rS, 3.0) / (2.0 * pow(r, 3.0))));
    *vTHETA =
        -norm_v * sin(theta) *
        (1.0 - (3.0 * rS / (4.0 * r)) - (pow(rS, 3.0) / (4.0 * pow(r, 3.0))));
  } else {
    *vR = 0.0;
    *vTHETA = 0.0;
  }
}


x86 assembly (clang, -O0):
<vel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    12de <vel+0x1ae>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe77(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xe7a(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe61(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe43(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe2c(%rip),%xmm1
call   1050 <pow@plt>
movsd  -0x68(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm4
movsd  -0x58(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm3
mulsd  %xmm4,%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xdb1(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xd9c(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd9b(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd7d(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xd66(%rip),%xmm1
call   1050 <pow@plt>
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm4
movsd  -0x38(%rbp),%xmm0
movsd  0xd3f(%rip),%xmm3
mulsd  %xmm4,%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    12f4 <vel+0x1c4>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vel>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
ucomisd %xmm0,%xmm2
jbe    1275 <vel+0x145>
movsd  %xmm0,0x10(%rsp)
movapd %xmm3,%xmm0
movapd %xmm2,0x20(%rsp)
movaps %xmm1,(%rsp)
movsd  %xmm3,0x48(%rsp)
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0xe87(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,0x50(%rsp)
movapd 0x20(%rsp),%xmm3
addsd  %xmm3,%xmm3
divsd  %xmm3,%xmm2
movsd  0xe65(%rip),%xmm3
subsd  %xmm2,%xmm3
movsd  %xmm3,0x38(%rsp)
call   1050 <pow@plt>
movsd  %xmm0,0x30(%rsp)
movapd 0x20(%rsp),%xmm0
movsd  0xe3a(%rip),%xmm1
call   1050 <pow@plt>
addsd  %xmm0,%xmm0
movsd  0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0x38(%rsp),%xmm1
mulsd  0x40(%rsp),%xmm1
movsd  %xmm1,(%rbx)
movaps (%rsp),%xmm0
xorps  0xe1c(%rip),%xmm0
movaps %xmm0,(%rsp)
movsd  0x48(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0xde5(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
movsd  0xdcd(%rip),%xmm1
call   1050 <pow@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movsd  0xdbe(%rip),%xmm0
mulpd  0xdce(%rip),%xmm1
movapd 0x50(%rsp),%xmm2
unpcklpd 0x10(%rsp),%xmm2
divpd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm2
subsd  %xmm2,%xmm0
mulsd  (%rsp),%xmm0
jmp    1280 <vel+0x150>
movq   $0x0,(%rbx)
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%r14)
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @vel(double %0, double %1, double %2, double %3, double* %4, double* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%13 = load double, double* %9
%14 = load double, double* %7
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %56
16: ; preds = %6
%17 = load double, double* %8
%18 = load double, double* %10
%19 = call double @cos(double %18)
%20 = fmul double %17, %19
%21 = load double, double* %7
%22 = fmul double 3.000000e+00, %21
%23 = load double, double* %9
%24 = fmul double 2.000000e+00, %23
%25 = fdiv double %22, %24
%26 = fsub double 1.000000e+00, %25
%27 = load double, double* %7
%28 = call double @pow(double %27, double 3.000000e+00)
%29 = load double, double* %9
%30 = call double @pow(double %29, double 3.000000e+00)
%31 = fmul double 2.000000e+00, %30
%32 = fdiv double %28, %31
%33 = fadd double %26, %32
%34 = fmul double %20, %33
%35 = load double*, double** %11
store double %34, double* %35
%36 = load double, double* %8
%37 = fneg double %36
%38 = load double, double* %10
%39 = call double @sin(double %38)
%40 = fmul double %37, %39
%41 = load double, double* %7
%42 = fmul double 3.000000e+00, %41
%43 = load double, double* %9
%44 = fmul double 4.000000e+00, %43
%45 = fdiv double %42, %44
%46 = fsub double 1.000000e+00, %45
%47 = load double, double* %7
%48 = call double @pow(double %47, double 3.000000e+00)
%49 = load double, double* %9
%50 = call double @pow(double %49, double 3.000000e+00)
%51 = fmul double 4.000000e+00, %50
%52 = fdiv double %48, %51
%53 = fsub double %46, %52
%54 = fmul double %40, %53
%55 = load double*, double** %12
store double %54, double* %55
br label %59
56: ; preds = %6
%57 = load double*, double** %11
store double 0.000000e+00, double* %57
%58 = load double*, double** %12
store double 0.000000e+00, double* %58
br label %59
59: ; preds = %56, %16
ret void
}

LLVM IR (-O2):
define void @vel(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fcmp ogt double %2, %0
br i1 %7, label %8, label %37
8: ; preds = %6
%9 = tail call double @cos(double %3)
%10 = fmul double %9, %1
%11 = fmul double %0, 3.000000e+00
%12 = fmul double %2, 2.000000e+00
%13 = fdiv double %11, %12
%14 = fsub double 1.000000e+00, %13
%15 = tail call double @pow(double %0, double 3.000000e+00)
%16 = tail call double @pow(double %2, double 3.000000e+00)
%17 = fmul double %16, 2.000000e+00
%18 = fdiv double %15, %17
%19 = fadd double %14, %18
%20 = fmul double %10, %19
store double %20, double* %4
%21 = fneg double %1
%22 = tail call double @sin(double %3)
%23 = fmul double %22, %21
%24 = tail call double @pow(double %0, double 3.000000e+00)
%25 = tail call double @pow(double %2, double 3.000000e+00)
%26 = insertelement <2 x double> poison, double %2, i64 0
%27 = insertelement <2 x double> %26, double %25, i64 1
%28 = fmul <2 x double> %27, <double 4.000000e+00, double 4.000000e+00>
%29 = insertelement <2 x double> poison, double %11, i64 0
%30 = insertelement <2 x double> %29, double %24, i64 1
%31 = fdiv <2 x double> %30, %28
%32 = extractelement <2 x double> %31, i64 0
%33 = fsub double 1.000000e+00, %32
%34 = extractelement <2 x double> %31, i64 1
%35 = fsub double %33, %34
%36 = fmul double %23, %35
br label %38
37: ; preds = %6
store double 0.000000e+00, double* %4
br label %38
38: ; preds = %37, %8
%39 = phi double [ 0.000000e+00, %37 ], [ %36, %8 ]
store double %39, double* %5
ret void
}