#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*/ mcdis_line(double, double, double, double, double, double);
void mcdis_dashed_line(double x1, double y1, double z1, double x2, double y2,
                       double z2, int n) {
  int i;
  const double dx = (x2 - x1) / (2 * n + 1);
  const double dy = (y2 - y1) / (2 * n + 1);
  const double dz = (z2 - z1) / (2 * n + 1);
  for (i = 0; i < n + 1; i++)
    mcdis_line(x1 + 2 * i * dx, y1 + 2 * i * dy, z1 + 2 * i * dz,
               x1 + (2 * i + 1) * dx, y1 + (2 * i + 1) * dy,
               z1 + (2 * i + 1) * dz);
}


x86 assembly (clang, -O0):
<mcdis_dashed_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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)
mov    %edi,-0x34(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1275 <mcdis_dashed_line+0x165>
movsd  -0x8(%rbp),%xmm1
mov    -0x38(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm2
mov    -0x38(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x48(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm3
mov    -0x38(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm2
movsd  -0x50(%rbp),%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movsd  -0x8(%rbp),%xmm4
mov    -0x38(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm3
movsd  -0x40(%rbp),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
movsd  -0x10(%rbp),%xmm5
mov    -0x38(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm4
movsd  -0x48(%rbp),%xmm6
mulsd  %xmm6,%xmm4
addsd  %xmm5,%xmm4
movsd  -0x18(%rbp),%xmm6
mov    -0x38(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm5
movsd  -0x50(%rbp),%xmm7
mulsd  %xmm7,%xmm5
addsd  %xmm6,%xmm5
call   1030 <mcdis_line@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11a0 <mcdis_dashed_line+0x90>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcdis_dashed_line>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
test   %edi,%edi
js     1210 <mcdis_dashed_line+0x100>
mov    %edi,%r14d
lea    (%r14,%r14,1),%eax
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x8(%rsp),%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,0x20(%rsp)
subsd  0x10(%rsp),%xmm4
divsd  %xmm0,%xmm4
movsd  %xmm4,0x28(%rsp)
subsd  0x18(%rsp),%xmm5
divsd  %xmm0,%xmm5
movsd  %xmm5,0x30(%rsp)
add    $0x1,%r14d
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movapd %xmm2,%xmm0
movsd  0x20(%rsp),%xmm4
mulsd  %xmm4,%xmm0
movsd  0x8(%rsp),%xmm10
addsd  %xmm10,%xmm0
movapd %xmm2,%xmm1
movsd  0x28(%rsp),%xmm7
mulsd  %xmm7,%xmm1
movsd  0x10(%rsp),%xmm9
addsd  %xmm9,%xmm1
movsd  0x30(%rsp),%xmm6
mulsd  %xmm6,%xmm2
movsd  0x18(%rsp),%xmm8
addsd  %xmm8,%xmm2
xorps  %xmm5,%xmm5
cvtsi2sd %ebx,%xmm5
movapd %xmm5,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm10,%xmm3
movapd %xmm5,%xmm4
mulsd  %xmm7,%xmm4
addsd  %xmm9,%xmm4
mulsd  %xmm6,%xmm5
addsd  %xmm8,%xmm5
call   1030 <mcdis_line@plt>
add    $0x2,%ebx
add    $0xffffffff,%r14d
jne    1180 <mcdis_dashed_line+0x70>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @mcdis_dashed_line(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6) {
%8 = fsub double %3, %0
%9 = shl nsw i32 %6, 1
%10 = or i32 %9, 1
%11 = sitofp i32 %10 to double
%12 = fdiv double %8, %11
%13 = fsub double %4, %1
%14 = fdiv double %13, %11
%15 = fsub double %5, %2
%16 = fdiv double %15, %11
%17 = icmp slt i32 %6, 0
br i1 %17, label %33, label %18
18: ; preds = %7, %18
%19 = phi i32 [ %31, %18 ], [ 0, %7 ]
%20 = shl nuw nsw i32 %19, 1
%21 = sitofp i32 %20 to double
%22 = tail call double @llvm.fmuladd.f64(double %21, double %12, double %0)
%23 = tail call double @llvm.fmuladd.f64(double %21, double %14, double %1)
%24 = tail call double @llvm.fmuladd.f64(double %21, double %16, double %2)
%25 = or i32 %20, 1
%26 = sitofp i32 %25 to double
%27 = tail call double @llvm.fmuladd.f64(double %26, double %12, double %0)
%28 = tail call double @llvm.fmuladd.f64(double %26, double %14, double %1)
%29 = tail call double @llvm.fmuladd.f64(double %26, double %16, double %2)
%30 = tail call i32 @mcdis_line(double %22, double %23, double %24, double %27, double %28, double %29)
%31 = add nuw i32 %19, 1
%32 = icmp eq i32 %19, %6
br i1 %32, label %33, label %18
33: ; preds = %18, %7
ret void
}