#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*/ SetDashSize(double, double);
int /*<<< orphan*/ SetTransferMatrix(double, double, double, double, double,
                                     double);
int /*<<< orphan*/ ZigZagHelp(double *, double);
scalar_t__ fabs(double);
double sqrt(double);
void DashZigZag(double *args) {
  double dx = args[2] - args[0];
  double dy = args[3] - args[1];
  double dr = sqrt(dx * dx + dy * dy);
  double dashsize = args[6];
  int n = args[5] * 2 + 0.5;
  double size = dr / (n * 2);
  SetTransferMatrix(1, 0, 0, 1, args[0], args[1]);
  SetTransferMatrix(dx / dr, dy / dr, -dy / dr, dx / dr, 0, 0);
  size = sqrt(size * size + args[4] * args[4]);
  n = size / (2 * dashsize);
  if (n == 0)
    n = 1;
  if (fabs(size - 2 * dashsize * n) > fabs(size - 2 * dashsize * (n + 1)))
    n++;
  dashsize = size / (2 * n);
  SetDashSize(dashsize, dashsize / 2);
  ZigZagHelp(args, dr);
}


x86 assembly (clang, -O0):
<DashZigZag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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   1070 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe3e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm4
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm5
movsd  0xdfa(%rip),%xmm3
xorps  %xmm2,%xmm2
movaps %xmm3,%xmm0
movaps %xmm2,%xmm1
call   1060 <SetTransferMatrix@plt>
movsd  -0x10(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
divsd  -0x20(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
divsd  -0x20(%rbp),%xmm3
xorps  %xmm5,%xmm5
movaps %xmm5,%xmm4
call   1060 <SetTransferMatrix@plt>
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x20(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xd5f(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    12c2 <DashZigZag+0x172>
movl   $0x1,-0x2c(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xd31(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <fabs@plt>
mov    %rax,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xcf2(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x2c(%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   1050 <fabs@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
jle    135a <DashZigZag+0x20a>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xc7c(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1040 <SetDashSize@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1030 <ZigZagHelp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DashZigZag>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%r15
movsd  0x10(%rdi),%xmm0
movsd  0x18(%rdi),%xmm1
subsd  (%rdi),%xmm0
subsd  0x8(%rdi),%xmm1
movapd %xmm1,0x20(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm0,(%rsp)
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1197 <DashZigZag+0x47>
sqrtsd %xmm0,%xmm0
jmp    119c <DashZigZag+0x4c>
call   1070 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%r15),%xmm1
addsd  %xmm1,%xmm1
addsd  0xe4c(%rip),%xmm1
cvttsd2si %xmm1,%eax
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x30(%r15),%xmm2
movsd  %xmm2,0x8(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%r15),%xmm4
movsd  0x8(%r15),%xmm5
movsd  0xe1e(%rip),%xmm0
xorpd  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm3
call   1060 <SetTransferMatrix@plt>
movsd  (%rsp),%xmm0
movsd  0x10(%rsp),%xmm3
divsd  %xmm3,%xmm0
movapd 0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
divsd  %xmm3,%xmm1
xorpd  0xe02(%rip),%xmm2
divsd  %xmm3,%xmm2
xorps  %xmm4,%xmm4
xorps  %xmm5,%xmm5
movapd %xmm0,%xmm3
call   1060 <SetTransferMatrix@plt>
movsd  0x20(%r15),%xmm0
mulsd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ucomisd 0xdbb(%rip),%xmm1
jb     125d <DashZigZag+0x10d>
sqrtsd %xmm0,%xmm0
jmp    1262 <DashZigZag+0x112>
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
addsd  %xmm3,%xmm3
movapd %xmm0,%xmm2
movsd  %xmm0,(%rsp)
divsd  %xmm3,%xmm0
movsd  %xmm3,0x8(%rsp)
cvttsd2si %xmm0,%eax
test   %eax,%eax
mov    $0x1,%ebx
cmovne %eax,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
call   1050 <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   1050 <fabs@plt>
cmp    %rax,%r14
cmovg  %ebp,%ebx
add    %ebx,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  (%rsp),%xmm2
divsd  %xmm0,%xmm2
movsd  0xd1a(%rip),%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm2,%xmm0
call   1040 <SetDashSize@plt>
mov    %r15,%rdi
movsd  0x10(%rsp),%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <ZigZagHelp@plt>

LLVM IR (-O0):
define void @DashZigZag(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store double* %0, double** %2
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 2
%11 = load double, double* %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = fsub double %11, %14
store double %15, double* %3
%16 = load double*, double** %2
%17 = getelementptr inbounds double, double* %16, i64 3
%18 = load double, double* %17
%19 = load double*, double** %2
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = fsub double %18, %21
store double %22, double* %4
%23 = load double, double* %3
%24 = load double, double* %3
%25 = load double, double* %4
%26 = load double, double* %4
%27 = fmul double %25, %26
%28 = call double @llvm.fmuladd.f64(double %23, double %24, double %27)
%29 = call double @sqrt(double %28)
store double %29, double* %5
%30 = load double*, double** %2
%31 = getelementptr inbounds double, double* %30, i64 6
%32 = load double, double* %31
store double %32, double* %6
%33 = load double*, double** %2
%34 = getelementptr inbounds double, double* %33, i64 5
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %35, double 2.000000e+00, double 5.000000e-01)
%37 = fptosi double %36 to i32
store i32 %37, i32* %7
%38 = load double, double* %5
%39 = load i32, i32* %7
%40 = mul nsw i32 %39, 2
%41 = sitofp i32 %40 to double
%42 = fdiv double %38, %41
store double %42, double* %8
%43 = load double*, double** %2
%44 = getelementptr inbounds double, double* %43, i64 0
%45 = load double, double* %44
%46 = load double*, double** %2
%47 = getelementptr inbounds double, double* %46, i64 1
%48 = load double, double* %47
%49 = call i32 @SetTransferMatrix(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00, double %45, double %48)
%50 = load double, double* %3
%51 = load double, double* %5
%52 = fdiv double %50, %51
%53 = load double, double* %4
%54 = load double, double* %5
%55 = fdiv double %53, %54
%56 = load double, double* %4
%57 = fneg double %56
%58 = load double, double* %5
%59 = fdiv double %57, %58
%60 = load double, double* %3
%61 = load double, double* %5
%62 = fdiv double %60, %61
%63 = call i32 @SetTransferMatrix(double %52, double %55, double %59, double %62, double 0.000000e+00, double 0.000000e+00)
%64 = load double, double* %8
%65 = load double, double* %8
%66 = load double*, double** %2
%67 = getelementptr inbounds double, double* %66, i64 4
%68 = load double, double* %67
%69 = load double*, double** %2
%70 = getelementptr inbounds double, double* %69, i64 4
%71 = load double, double* %70
%72 = fmul double %68, %71
%73 = call double @llvm.fmuladd.f64(double %64, double %65, double %72)
%74 = call double @sqrt(double %73)
store double %74, double* %8
%75 = load double, double* %8
%76 = load double, double* %6
%77 = fmul double 2.000000e+00, %76
%78 = fdiv double %75, %77
%79 = fptosi double %78 to i32
store i32 %79, i32* %7
%80 = load i32, i32* %7
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %83
82: ; preds = %1
store i32 1, i32* %7
br label %83
83: ; preds = %82, %1
%84 = load double, double* %8
%85 = load double, double* %6
%86 = fmul double 2.000000e+00, %85
%87 = load i32, i32* %7
%88 = sitofp i32 %87 to double
%89 = fneg double %86
%90 = call double @llvm.fmuladd.f64(double %89, double %88, double %84)
%91 = call i64 @fabs(double %90)
%92 = load double, double* %8
%93 = load double, double* %6
%94 = fmul double 2.000000e+00, %93
%95 = load i32, i32* %7
%96 = add nsw i32 %95, 1
%97 = sitofp i32 %96 to double
%98 = fneg double %94
%99 = call double @llvm.fmuladd.f64(double %98, double %97, double %92)
%100 = call i64 @fabs(double %99)
%101 = icmp sgt i64 %91, %100
br i1 %101, label %102, label %105
102: ; preds = %83
%103 = load i32, i32* %7
%104 = add nsw i32 %103, 1
store i32 %104, i32* %7
br label %105
105: ; preds = %102, %83
%106 = load double, double* %8
%107 = load i32, i32* %7
%108 = mul nsw i32 2, %107
%109 = sitofp i32 %108 to double
%110 = fdiv double %106, %109
store double %110, double* %6
%111 = load double, double* %6
%112 = load double, double* %6
%113 = fdiv double %112, 2.000000e+00
%114 = call i32 @SetDashSize(double %111, double %113)
%115 = load double*, double** %2
%116 = load double, double* %5
%117 = call i32 @ZigZagHelp(double* %115, double %116)
ret void
}

LLVM IR (-O2):
define void @DashZigZag(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 6
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %0, i64 5
%17 = load double, double* %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double 2.000000e+00, double 5.000000e-01)
%19 = fptosi double %18 to i32
%20 = shl nsw i32 %19, 1
%21 = sitofp i32 %20 to double
%22 = fdiv double %13, %21
%23 = load double, double* %0
%24 = load double, double* %8
%25 = tail call i32 @SetTransferMatrix(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00, double %23, double %24)
%26 = fdiv double %5, %13
%27 = fdiv double %10, %13
%28 = fneg double %10
%29 = fdiv double %28, %13
%30 = tail call i32 @SetTransferMatrix(double %26, double %27, double %29, double %26, double 0.000000e+00, double 0.000000e+00)
%31 = getelementptr inbounds double, double* %0, i64 4
%32 = load double, double* %31
%33 = fmul double %32, %32
%34 = tail call double @llvm.fmuladd.f64(double %22, double %22, double %33)
%35 = tail call double @sqrt(double %34)
%36 = fmul double %15, 2.000000e+00
%37 = fdiv double %35, %36
%38 = fptosi double %37 to i32
%39 = icmp eq i32 %38, 0
%40 = select i1 %39, i32 1, i32 %38
%41 = sitofp i32 %40 to double
%42 = fneg double %36
%43 = tail call double @llvm.fmuladd.f64(double %42, double %41, double %35)
%44 = tail call i64 @fabs(double %43)
%45 = add nsw i32 %40, 1
%46 = sitofp i32 %45 to double
%47 = tail call double @llvm.fmuladd.f64(double %42, double %46, double %35)
%48 = tail call i64 @fabs(double %47)
%49 = icmp sgt i64 %44, %48
%50 = select i1 %49, i32 %45, i32 %40
%51 = shl nsw i32 %50, 1
%52 = sitofp i32 %51 to double
%53 = fdiv double %35, %52
%54 = fmul double %53, 5.000000e-01
%55 = tail call i32 @SetDashSize(double %53, double %54)
%56 = tail call i32 @ZigZagHelp(double* %0, double %13)
ret void
}