#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*/ Line(double *);
int /*<<< orphan*/ SetDashSize(double, double);
double sqrt(double);
void DashLine(double *args) {
  double dx = args[2] - args[0], dy = args[3] - args[1],
         dr = sqrt(dx * dx + dy * dy);
  double dashsize = args[4];
  int num;
  num = dr / dashsize;
  if ((num % 2) == 1)
    num++;
  dashsize = dr / num;
  SetDashSize(dashsize, dashsize / 2);
  Line(args);
}


x86 assembly (clang, -O0):
<DashLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11cb <DashLine+0x9b>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe10(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1040 <SetDashSize@plt>
mov    -0x8(%rbp),%rdi
call   1030 <Line@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DashLine>:
push   %rbx
mov    %rdi,%rbx
movsd  0x10(%rdi),%xmm0
movsd  0x18(%rdi),%xmm1
subsd  (%rdi),%xmm0
subsd  0x8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1163 <DashLine+0x33>
sqrtsd %xmm0,%xmm0
jmp    1168 <DashLine+0x38>
call   1050 <sqrt@plt>
movapd %xmm0,%xmm1
divsd  0x20(%rbx),%xmm1
cvttsd2si %xmm1,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
mov    %eax,%edx
sub    %ecx,%edx
xor    %ecx,%ecx
cmp    $0x1,%edx
sete   %cl
add    %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe60(%rip),%xmm1
mulsd  %xmm0,%xmm1
call   1040 <SetDashSize@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <Line@plt>

LLVM IR (-O0):
define void @DashLine(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double* %0, double** %2
%8 = load double*, double** %2
%9 = getelementptr inbounds double, double* %8, i64 2
%10 = load double, double* %9
%11 = load double*, double** %2
%12 = getelementptr inbounds double, double* %11, i64 0
%13 = load double, double* %12
%14 = fsub double %10, %13
store double %14, double* %3
%15 = load double*, double** %2
%16 = getelementptr inbounds double, double* %15, i64 3
%17 = load double, double* %16
%18 = load double*, double** %2
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = fsub double %17, %20
store double %21, double* %4
%22 = load double, double* %3
%23 = load double, double* %3
%24 = load double, double* %4
%25 = load double, double* %4
%26 = fmul double %24, %25
%27 = call double @llvm.fmuladd.f64(double %22, double %23, double %26)
%28 = call double @sqrt(double %27)
store double %28, double* %5
%29 = load double*, double** %2
%30 = getelementptr inbounds double, double* %29, i64 4
%31 = load double, double* %30
store double %31, double* %6
%32 = load double, double* %5
%33 = load double, double* %6
%34 = fdiv double %32, %33
%35 = fptosi double %34 to i32
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = srem i32 %36, 2
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %42
39: ; preds = %1
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %42
42: ; preds = %39, %1
%43 = load double, double* %5
%44 = load i32, i32* %7
%45 = sitofp i32 %44 to double
%46 = fdiv double %43, %45
store double %46, double* %6
%47 = load double, double* %6
%48 = load double, double* %6
%49 = fdiv double %48, 2.000000e+00
%50 = call i32 @SetDashSize(double %47, double %49)
%51 = load double*, double** %2
%52 = call i32 @Line(double* %51)
ret void
}

LLVM IR (-O2):
define void @DashLine(double* %0) {
%2 = getelementptr inbounds double, double* %0, i64 2
%3 = load double, double* %2
%4 = load double, double* %0
%5 = fsub double %3, %4
%6 = getelementptr inbounds double, double* %0, i64 3
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = fsub double %7, %9
%11 = fmul double %10, %10
%12 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %11)
%13 = tail call double @sqrt(double %12)
%14 = getelementptr inbounds double, double* %0, i64 4
%15 = load double, double* %14
%16 = fdiv double %13, %15
%17 = fptosi double %16 to i32
%18 = srem i32 %17, 2
%19 = icmp eq i32 %18, 1
%20 = zext i1 %19 to i32
%21 = add nsw i32 %20, %17
%22 = sitofp i32 %21 to double
%23 = fdiv double %13, %22
%24 = fmul double %23, 5.000000e-01
%25 = tail call i32 @SetDashSize(double %23, double %24)
%26 = tail call i32 @Line(double* %0)
ret void
}