#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 LengthBezier(double, int /*<<< orphan*/, double, int, double, int,
                    double);
scalar_t__ fabs(double);
double ComputeDash(double *args, double dr, double indash) {
  int numwindings = args[5] + 0.5, numdashes;
  int numhalfwindings = 2 * numwindings + 2.1;
  double onehalfwinding = dr / numhalfwindings;
  double amp8 = fabs(args[4]) * 0.9;
  double size = LengthBezier(-amp8, 0, -amp8, 2 * args[4], onehalfwinding,
                             2 * args[4], 1.0);
  numdashes = size / (2 * indash);
  if (numdashes == 0)
    numdashes = 1;
  if (fabs(size - 2 * indash * numdashes) >
      fabs(size - 2 * indash * (numdashes + 1)))
    numdashes++;
  return (size / (2 * numdashes));
}


x86 assembly (clang, -O0):
<ComputeDash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xede(%rip),%xmm0
addsd  0x28(%rax),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xeb8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %rax,%xmm0
movsd  0xe77(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mov    -0x8(%rbp),%rax
movsd  0xe1a(%rip),%xmm2
mulsd  0x20(%rax),%xmm2
cvttsd2si %xmm2,%esi
movsd  -0x30(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0xe00(%rip),%xmm3
mulsd  0x20(%rax),%xmm3
cvttsd2si %xmm3,%edx
xor    %edi,%edi
movsd  0xdf5(%rip),%xmm3
call   1030 <LengthBezier@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xdd6(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    124b <ComputeDash+0x12b>
movl   $0x1,-0x20(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  0xda8(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <fabs@plt>
mov    %rax,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  0xd69(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <fabs@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
cmp    %rcx,%rax
jle    12e3 <ComputeDash+0x1c3>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComputeDash>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  0x28(%rdi),%xmm2
addsd  0xec8(%rip),%xmm2
cvttsd2si %xmm2,%eax
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm2
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xeb1(%rip),%xmm0
cvttpd2dq %xmm0,%xmm1
movsd  0x20(%rdi),%xmm0
cvtdq2pd %xmm1,%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
call   1040 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mulsd  0xe8e(%rip),%xmm0
movsd  0x20(%rbx),%xmm1
addsd  %xmm1,%xmm1
cvttsd2si %xmm1,%edx
movsd  0xe81(%rip),%xmm3
xor    %edi,%edi
movapd %xmm0,%xmm1
mov    %edx,%esi
movsd  (%rsp),%xmm2
call   1030 <LengthBezier@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
movapd %xmm1,%xmm3
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm2,%eax
test   %eax,%eax
mov    $0x1,%ebx
cmovne %eax,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  %xmm3,%xmm1
subsd  %xmm1,%xmm0
call   1040 <fabs@plt>
mov    %rax,%r14
lea    0x1(%rbx),%ebp
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm0
subsd  %xmm1,%xmm0
call   1040 <fabs@plt>
cmp    %rax,%r14
cmovg  %ebp,%ebx
add    %ebx,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @ComputeDash(double* %0, double %1, double %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double* %0, double** %4
store double %1, double* %5
store double %2, double* %6
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 5
%15 = load double, double* %14
%16 = fadd double %15, 5.000000e-01
%17 = fptosi double %16 to i32
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = mul nsw i32 2, %18
%20 = sitofp i32 %19 to double
%21 = fadd double %20, 2.100000e+00
%22 = fptosi double %21 to i32
store i32 %22, i32* %9
%23 = load double, double* %5
%24 = load i32, i32* %9
%25 = sitofp i32 %24 to double
%26 = fdiv double %23, %25
store double %26, double* %10
%27 = load double*, double** %4
%28 = getelementptr inbounds double, double* %27, i64 4
%29 = load double, double* %28
%30 = call i64 @fabs(double %29)
%31 = sitofp i64 %30 to double
%32 = fmul double %31, 9.000000e-01
store double %32, double* %11
%33 = load double, double* %11
%34 = fneg double %33
%35 = load double, double* %11
%36 = fneg double %35
%37 = load double*, double** %4
%38 = getelementptr inbounds double, double* %37, i64 4
%39 = load double, double* %38
%40 = fmul double 2.000000e+00, %39
%41 = fptosi double %40 to i32
%42 = load double, double* %10
%43 = load double*, double** %4
%44 = getelementptr inbounds double, double* %43, i64 4
%45 = load double, double* %44
%46 = fmul double 2.000000e+00, %45
%47 = fptosi double %46 to i32
%48 = call double @LengthBezier(double %34, i32 0, double %36, i32 %41, double %42, i32 %47, double 1.000000e+00)
store double %48, double* %12
%49 = load double, double* %12
%50 = load double, double* %6
%51 = fmul double 2.000000e+00, %50
%52 = fdiv double %49, %51
%53 = fptosi double %52 to i32
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %3
store i32 1, i32* %8
br label %57
57: ; preds = %56, %3
%58 = load double, double* %12
%59 = load double, double* %6
%60 = fmul double 2.000000e+00, %59
%61 = load i32, i32* %8
%62 = sitofp i32 %61 to double
%63 = fneg double %60
%64 = call double @llvm.fmuladd.f64(double %63, double %62, double %58)
%65 = call i64 @fabs(double %64)
%66 = load double, double* %12
%67 = load double, double* %6
%68 = fmul double 2.000000e+00, %67
%69 = load i32, i32* %8
%70 = add nsw i32 %69, 1
%71 = sitofp i32 %70 to double
%72 = fneg double %68
%73 = call double @llvm.fmuladd.f64(double %72, double %71, double %66)
%74 = call i64 @fabs(double %73)
%75 = icmp sgt i64 %65, %74
br i1 %75, label %76, label %79
76: ; preds = %57
%77 = load i32, i32* %8
%78 = add nsw i32 %77, 1
store i32 %78, i32* %8
br label %79
79: ; preds = %76, %57
%80 = load double, double* %12
%81 = load i32, i32* %8
%82 = mul nsw i32 2, %81
%83 = sitofp i32 %82 to double
%84 = fdiv double %80, %83
ret double %84
}

LLVM IR (-O2):
define double @ComputeDash(double* nocapture %0, double %1, double %2) {
%4 = getelementptr inbounds double, double* %0, i64 5
%5 = load double, double* %4
%6 = fadd double %5, 5.000000e-01
%7 = fptosi double %6 to i32
%8 = shl nsw i32 %7, 1
%9 = sitofp i32 %8 to double
%10 = fadd double %9, 2.100000e+00
%11 = fptosi double %10 to i32
%12 = sitofp i32 %11 to double
%13 = fdiv double %1, %12
%14 = getelementptr inbounds double, double* %0, i64 4
%15 = load double, double* %14
%16 = tail call i64 @fabs(double %15)
%17 = sitofp i64 %16 to double
%18 = fmul double %17, -9.000000e-01
%19 = load double, double* %14
%20 = fmul double %19, 2.000000e+00
%21 = fptosi double %20 to i32
%22 = tail call double @LengthBezier(double %18, i32 0, double %18, i32 %21, double %13, i32 %21, double 1.000000e+00)
%23 = fmul double %2, 2.000000e+00
%24 = fdiv double %22, %23
%25 = fptosi double %24 to i32
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i32 1, i32 %25
%28 = sitofp i32 %27 to double
%29 = fneg double %23
%30 = tail call double @llvm.fmuladd.f64(double %29, double %28, double %22)
%31 = tail call i64 @fabs(double %30)
%32 = add nsw i32 %27, 1
%33 = sitofp i32 %32 to double
%34 = tail call double @llvm.fmuladd.f64(double %29, double %33, double %22)
%35 = tail call i64 @fabs(double %34)
%36 = icmp sgt i64 %31, %35
%37 = select i1 %36, i32 %32, i32 %27
%38 = shl nsw i32 %37, 1
%39 = sitofp i32 %38 to double
%40 = fdiv double %22, %39
ret double %40
}