#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 sin(float);
float sqrt(float);
float ellipseExtent(float angle, float *axisLengths) {
  float X = axisLengths[0];
  float Y = axisLengths[1];
  float cosa = cos(angle);
  float sina = sin(angle);
  return 1.0f / sqrt(cosa * cosa / (X * X) + sina * sina / (Y * Y));
}


x86 assembly (clang, -O0):
<ellipseExtent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  -0x20(%rbp),%xmm1
mulss  -0x20(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
mulss  -0x18(%rbp),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  0xe42(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ellipseExtent>:
sub    $0x38,%rsp
movaps %xmm0,%xmm1
movss  %xmm0,0xc(%rsp)
movsd  (%rdi),%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
movaps 0x10(%rsp),%xmm1
unpcklps %xmm0,%xmm1
mulps  %xmm1,%xmm1
movaps 0x20(%rsp),%xmm0
mulps  %xmm0,%xmm0
divps  %xmm0,%xmm1
movaps %xmm1,%xmm0
shufps $0x55,%xmm1,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     118d <ellipseExtent+0x5d>
sqrtss %xmm0,%xmm0
jmp    1192 <ellipseExtent+0x62>
call   1050 <sqrt@plt>
movss  0xe66(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define float @ellipseExtent(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %3
store float* %1, float** %4
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
store float %11, float* %5
%12 = load float*, float** %4
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
store float %14, float* %6
%15 = load float, float* %3
%16 = call float @cos(float %15)
store float %16, float* %7
%17 = load float, float* %3
%18 = call float @sin(float %17)
store float %18, float* %8
%19 = load float, float* %7
%20 = load float, float* %7
%21 = fmul float %19, %20
%22 = load float, float* %5
%23 = load float, float* %5
%24 = fmul float %22, %23
%25 = fdiv float %21, %24
%26 = load float, float* %8
%27 = load float, float* %8
%28 = fmul float %26, %27
%29 = load float, float* %6
%30 = load float, float* %6
%31 = fmul float %29, %30
%32 = fdiv float %28, %31
%33 = fadd float %25, %32
%34 = call float @sqrt(float %33)
%35 = fdiv float 1.000000e+00, %34
ret float %35
}

LLVM IR (-O2):
define float @ellipseExtent(float %0, float* nocapture %1) {
%3 = bitcast float* %1 to <2 x float>*
%4 = load <2 x float>, <2 x float>* %3
%5 = tail call float @cos(float %0)
%6 = tail call float @sin(float %0)
%7 = insertelement <2 x float> poison, float %5, i64 0
%8 = insertelement <2 x float> %7, float %6, i64 1
%9 = fmul <2 x float> %8, %8
%10 = fmul <2 x float> %4, %4
%11 = fdiv <2 x float> %9, %10
%12 = shufflevector <2 x float> %11, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%13 = fadd <2 x float> %11, %12
%14 = extractelement <2 x float> %13, i64 0
%15 = tail call float @sqrt(float %14)
%16 = fdiv float 1.000000e+00, %15
ret float %16
}