#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 sin(double);
double sqrt(double);
void ellipse_foci(double *param, double *foci) {
  double f = sqrt(param[2] * param[2] - param[3] * param[3]);
  foci[0] = param[0] + f * cos(param[4]);
  foci[1] = param[1] + f * sin(param[4]);
  foci[2] = param[0] - f * cos(param[4]);
  foci[3] = param[1] - f * sin(param[4]);
}


x86 assembly (clang, -O0):
<ellipse_foci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
call   1040 <cos@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
call   1030 <sin@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
call   1040 <cos@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
call   1030 <sin@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ellipse_foci>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  0x10(%rdi),%xmm0
movsd  0x18(%rdi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1163 <ellipse_foci+0x33>
sqrtsd %xmm0,%xmm0
jmp    1168 <ellipse_foci+0x38>
call   1050 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rbx),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rbx),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rbx),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%r14)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rbx),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ellipse_foci(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 2
%8 = load double, double* %7
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 2
%11 = load double, double* %10
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 3
%14 = load double, double* %13
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 3
%17 = load double, double* %16
%18 = fmul double %14, %17
%19 = fneg double %18
%20 = call double @llvm.fmuladd.f64(double %8, double %11, double %19)
%21 = call double @sqrt(double %20)
store double %21, double* %5
%22 = load double*, double** %3
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = load double, double* %5
%26 = load double*, double** %3
%27 = getelementptr inbounds double, double* %26, i64 4
%28 = load double, double* %27
%29 = call double @cos(double %28)
%30 = call double @llvm.fmuladd.f64(double %25, double %29, double %24)
%31 = load double*, double** %4
%32 = getelementptr inbounds double, double* %31, i64 0
store double %30, double* %32
%33 = load double*, double** %3
%34 = getelementptr inbounds double, double* %33, i64 1
%35 = load double, double* %34
%36 = load double, double* %5
%37 = load double*, double** %3
%38 = getelementptr inbounds double, double* %37, i64 4
%39 = load double, double* %38
%40 = call double @sin(double %39)
%41 = call double @llvm.fmuladd.f64(double %36, double %40, double %35)
%42 = load double*, double** %4
%43 = getelementptr inbounds double, double* %42, i64 1
store double %41, double* %43
%44 = load double*, double** %3
%45 = getelementptr inbounds double, double* %44, i64 0
%46 = load double, double* %45
%47 = load double, double* %5
%48 = load double*, double** %3
%49 = getelementptr inbounds double, double* %48, i64 4
%50 = load double, double* %49
%51 = call double @cos(double %50)
%52 = fneg double %47
%53 = call double @llvm.fmuladd.f64(double %52, double %51, double %46)
%54 = load double*, double** %4
%55 = getelementptr inbounds double, double* %54, i64 2
store double %53, double* %55
%56 = load double*, double** %3
%57 = getelementptr inbounds double, double* %56, i64 1
%58 = load double, double* %57
%59 = load double, double* %5
%60 = load double*, double** %3
%61 = getelementptr inbounds double, double* %60, i64 4
%62 = load double, double* %61
%63 = call double @sin(double %62)
%64 = fneg double %59
%65 = call double @llvm.fmuladd.f64(double %64, double %63, double %58)
%66 = load double*, double** %4
%67 = getelementptr inbounds double, double* %66, i64 3
store double %65, double* %67
ret void
}

LLVM IR (-O2):
define void @ellipse_foci(double* nocapture %0, double* nocapture writeonly %1) {
%3 = getelementptr inbounds double, double* %0, i64 2
%4 = load double, double* %3
%5 = getelementptr inbounds double, double* %0, i64 3
%6 = load double, double* %5
%7 = fneg double %6
%8 = fmul double %6, %7
%9 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %8)
%10 = tail call double @sqrt(double %9)
%11 = load double, double* %0
%12 = getelementptr inbounds double, double* %0, i64 4
%13 = load double, double* %12
%14 = tail call double @cos(double %13)
%15 = tail call double @llvm.fmuladd.f64(double %10, double %14, double %11)
store double %15, double* %1
%16 = getelementptr inbounds double, double* %0, i64 1
%17 = load double, double* %16
%18 = load double, double* %12
%19 = tail call double @sin(double %18)
%20 = tail call double @llvm.fmuladd.f64(double %10, double %19, double %17)
%21 = getelementptr inbounds double, double* %1, i64 1
store double %20, double* %21
%22 = load double, double* %0
%23 = load double, double* %12
%24 = tail call double @cos(double %23)
%25 = fneg double %10
%26 = tail call double @llvm.fmuladd.f64(double %25, double %24, double %22)
%27 = getelementptr inbounds double, double* %1, i64 2
store double %26, double* %27
%28 = load double, double* %16
%29 = load double, double* %12
%30 = tail call double @sin(double %29)
%31 = tail call double @llvm.fmuladd.f64(double %25, double %30, double %28)
%32 = getelementptr inbounds double, double* %1, i64 3
store double %31, double* %32
ret void
}