#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 */
float cos(float);
float shapefunc(float theta, void *data) {
  float *vals;
  float R, a, b;
  float ct;
  vals = (float *)data;
  R = vals[0];
  a = vals[1];
  b = vals[2];
  ct = cos(theta);
  return (1.0 / (a * ct - b * ct * ct + R));
}


x86 assembly (clang, -O0):
<shapefunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <cos@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x28(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  -0x28(%rbp),%xmm1
mulss  -0x28(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe60(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shapefunc>:
sub    $0x18,%rsp
movss  (%rdi),%xmm1
movss  %xmm1,0x14(%rsp)
movss  0x4(%rdi),%xmm1
movss  %xmm1,0x10(%rsp)
movss  0x8(%rdi),%xmm1
movss  %xmm1,0xc(%rsp)
call   1030 <cos@plt>
movss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
movaps %xmm1,%xmm2
movss  0x10(%rsp),%xmm1
mulss  %xmm0,%xmm1
subss  %xmm2,%xmm1
addss  0x14(%rsp),%xmm1
movss  0xe9a(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @shapefunc(float %0, i8* %1) {
%3 = alloca float
%4 = alloca i8*
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %3
store i8* %1, i8** %4
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to float*
store float* %11, float** %5
%12 = load float*, float** %5
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
store float %14, float* %6
%15 = load float*, float** %5
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
store float %17, float* %7
%18 = load float*, float** %5
%19 = getelementptr inbounds float, float* %18, i64 2
%20 = load float, float* %19
store float %20, float* %8
%21 = load float, float* %3
%22 = call float @cos(float %21)
store float %22, float* %9
%23 = load float, float* %7
%24 = load float, float* %9
%25 = load float, float* %8
%26 = load float, float* %9
%27 = fmul float %25, %26
%28 = load float, float* %9
%29 = fmul float %27, %28
%30 = fneg float %29
%31 = call float @llvm.fmuladd.f32(float %23, float %24, float %30)
%32 = load float, float* %6
%33 = fadd float %31, %32
%34 = fpext float %33 to double
%35 = fdiv double 1.000000e+00, %34
%36 = fptrunc double %35 to float
ret float %36
}

LLVM IR (-O2):
define float @shapefunc(float %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to float*
%4 = load float, float* %3
%5 = getelementptr inbounds i8, i8* %1, i64 4
%6 = bitcast i8* %5 to float*
%7 = load float, float* %6
%8 = getelementptr inbounds i8, i8* %1, i64 8
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
%11 = tail call float @cos(float %0)
%12 = fneg float %10
%13 = fmul float %11, %12
%14 = fmul float %11, %13
%15 = tail call float @llvm.fmuladd.f32(float %7, float %11, float %14)
%16 = fadd float %4, %15
%17 = fdiv float 1.000000e+00, %16
ret float %17
}