#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*/ Bezier(double, double, double, double, double, double);
void DoCurve(double x0, double y0, double x1, double y1, double x2, double y2,
             double x3, double y3) {
  double xx1, yy1, xx2, yy2;
  xx1 = (2 * x1 + x2) / 3;
  yy1 = ((y1 - y0) / (x1 - x0) * (x2 - x0) + (y2 - y0) / (x2 - x0) * (x1 - x0) +
         y1 + 2 * y0) /
        3;
  xx2 = (x1 + 2 * x2) / 3;
  yy2 = ((y2 - y3) / (x2 - x3) * (x1 - x3) + (y1 - y3) / (x1 - x3) * (x2 - x3) +
         y2 + 2 * y3) /
        3;
  Bezier(xx1, yy1, xx2, yy2, x2, y2);
}


x86 assembly (clang, -O0):
<DoCurve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xea6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm3
subsd  -0x8(%rbp),%xmm3
divsd  %xmm3,%xmm0
movsd  -0x18(%rbp),%xmm3
subsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe33(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe10(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm2
subsd  -0x38(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm3
subsd  -0x38(%rbp),%xmm3
divsd  %xmm3,%xmm0
movsd  -0x28(%rbp),%xmm3
subsd  -0x38(%rbp),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
addsd  -0x30(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd9d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  -0x30(%rbp),%xmm5
call   1030 <Bezier@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoCurve>:
movapd %xmm0,%xmm8
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm4,%xmm0
movapd %xmm3,%xmm10
subsd  %xmm1,%xmm10
movapd %xmm2,%xmm11
subsd  %xmm8,%xmm11
divsd  %xmm11,%xmm10
movapd %xmm4,%xmm9
movapd %xmm4,%xmm12
movapd %xmm4,%xmm13
subsd  %xmm8,%xmm13
movapd %xmm5,%xmm8
subsd  %xmm1,%xmm8
divsd  %xmm13,%xmm8
mulsd  %xmm11,%xmm8
mulsd  %xmm10,%xmm13
movsd  0xe90(%rip),%xmm10
divsd  %xmm10,%xmm0
addsd  %xmm8,%xmm13
addsd  %xmm3,%xmm13
addsd  %xmm1,%xmm1
addsd  %xmm13,%xmm1
divsd  %xmm10,%xmm1
addsd  %xmm4,%xmm9
addsd  %xmm2,%xmm9
divsd  %xmm10,%xmm9
movapd %xmm5,%xmm8
subsd  %xmm7,%xmm8
subsd  %xmm6,%xmm12
divsd  %xmm12,%xmm8
subsd  %xmm6,%xmm2
subsd  %xmm7,%xmm3
divsd  %xmm2,%xmm3
mulsd  %xmm12,%xmm3
mulsd  %xmm2,%xmm8
addsd  %xmm8,%xmm3
addsd  %xmm5,%xmm3
addsd  %xmm7,%xmm7
addsd  %xmm7,%xmm3
divsd  %xmm10,%xmm3
movapd %xmm9,%xmm2
jmp    1030 <Bezier@plt>

LLVM IR (-O0):
define void @DoCurve(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
store double %7, double* %16
%21 = load double, double* %11
%22 = load double, double* %13
%23 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %21, double %22)
%24 = fdiv double %23, 3.000000e+00
store double %24, double* %17
%25 = load double, double* %12
%26 = load double, double* %10
%27 = fsub double %25, %26
%28 = load double, double* %11
%29 = load double, double* %9
%30 = fsub double %28, %29
%31 = fdiv double %27, %30
%32 = load double, double* %13
%33 = load double, double* %9
%34 = fsub double %32, %33
%35 = load double, double* %14
%36 = load double, double* %10
%37 = fsub double %35, %36
%38 = load double, double* %13
%39 = load double, double* %9
%40 = fsub double %38, %39
%41 = fdiv double %37, %40
%42 = load double, double* %11
%43 = load double, double* %9
%44 = fsub double %42, %43
%45 = fmul double %41, %44
%46 = call double @llvm.fmuladd.f64(double %31, double %34, double %45)
%47 = load double, double* %12
%48 = fadd double %46, %47
%49 = load double, double* %10
%50 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %49, double %48)
%51 = fdiv double %50, 3.000000e+00
store double %51, double* %18
%52 = load double, double* %11
%53 = load double, double* %13
%54 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %53, double %52)
%55 = fdiv double %54, 3.000000e+00
store double %55, double* %19
%56 = load double, double* %14
%57 = load double, double* %16
%58 = fsub double %56, %57
%59 = load double, double* %13
%60 = load double, double* %15
%61 = fsub double %59, %60
%62 = fdiv double %58, %61
%63 = load double, double* %11
%64 = load double, double* %15
%65 = fsub double %63, %64
%66 = load double, double* %12
%67 = load double, double* %16
%68 = fsub double %66, %67
%69 = load double, double* %11
%70 = load double, double* %15
%71 = fsub double %69, %70
%72 = fdiv double %68, %71
%73 = load double, double* %13
%74 = load double, double* %15
%75 = fsub double %73, %74
%76 = fmul double %72, %75
%77 = call double @llvm.fmuladd.f64(double %62, double %65, double %76)
%78 = load double, double* %14
%79 = fadd double %77, %78
%80 = load double, double* %16
%81 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %80, double %79)
%82 = fdiv double %81, 3.000000e+00
store double %82, double* %20
%83 = load double, double* %17
%84 = load double, double* %18
%85 = load double, double* %19
%86 = load double, double* %20
%87 = load double, double* %13
%88 = load double, double* %14
%89 = call i32 @Bezier(double %83, double %84, double %85, double %86, double %87, double %88)
ret void
}

LLVM IR (-O2):
define void @DoCurve(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = tail call double @llvm.fmuladd.f64(double %2, double 2.000000e+00, double %4)
%10 = fdiv double %9, 3.000000e+00
%11 = fsub double %3, %1
%12 = fsub double %2, %0
%13 = fdiv double %11, %12
%14 = fsub double %4, %0
%15 = fsub double %5, %1
%16 = fdiv double %15, %14
%17 = fmul double %12, %16
%18 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %17)
%19 = fadd double %18, %3
%20 = tail call double @llvm.fmuladd.f64(double %1, double 2.000000e+00, double %19)
%21 = fdiv double %20, 3.000000e+00
%22 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double %2)
%23 = fdiv double %22, 3.000000e+00
%24 = fsub double %5, %7
%25 = fsub double %4, %6
%26 = fdiv double %24, %25
%27 = fsub double %2, %6
%28 = fsub double %3, %7
%29 = fdiv double %28, %27
%30 = fmul double %25, %29
%31 = tail call double @llvm.fmuladd.f64(double %26, double %27, double %30)
%32 = fadd double %31, %5
%33 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %32)
%34 = fdiv double %33, 3.000000e+00
%35 = tail call i32 @Bezier(double %10, double %21, double %23, double %34, double %4, double %5)
ret void
}