#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*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, ...);
double sqrt(double);
int main(void) {
  int nailcount;
  double radius;
  scanf("%d %lf", &nailcount, &radius);
  double xcoor[nailcount + 1], ycoor[nailcount + 1], length = 0, temp;
  for (int i = 0; i < nailcount; i++)
    scanf("%lf %lf", &xcoor[i], &ycoor[i]);
  xcoor[nailcount] = xcoor[0];
  ycoor[nailcount] = ycoor[0];
  for (int i = 0; i < nailcount; i++) {
    temp = sqrt(((xcoor[i] - xcoor[i + 1]) * (xcoor[i] - xcoor[i + 1])) +
                ((ycoor[i] - ycoor[i + 1]) * (ycoor[i] - ycoor[i + 1])));
    length += temp;
  }
  length += (3.141592 * radius * 2);
  printf("%.02lf", length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f7 <main+0xc7>
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rsi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11b1 <main+0x81>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsd  (%rcx),%xmm0
movslq -0x8(%rbp),%rdx
movsd  %xmm0,(%rcx,%rdx,8)
movsd  (%rax),%xmm0
movslq -0x8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c3 <main+0x193>
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
movslq -0x40(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
mov    -0x40(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
subsd  (%rcx,%rdx,8),%xmm0
movslq -0x40(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm2
mov    -0x40(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
subsd  (%rcx,%rdx,8),%xmm2
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1220 <main+0xf0>
movsd  0xd35(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xd29(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xec0(%rip),%rdi
lea    -0x2c(%rbp),%rsi
lea    -0x48(%rbp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rsp,%r14
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%r13
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    -0x2c(%rbp),%eax
lea    0x1(%rax),%ecx
mov    %rsp,%r12
lea    0xf(,%rcx,8),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r12
mov    %r12,%rsp
xorpd  %xmm2,%xmm2
test   %eax,%eax
jle    1267 <main+0x137>
mov    %r14,-0x38(%rbp)
mov    %r13,%r15
mov    %r12,%rbx
xor    %r14d,%r14d
nopl   0x0(%rax)
lea    0xe58(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%r14
movslq -0x2c(%rbp),%rax
add    $0x8,%rbx
add    $0x8,%r15
cmp    %rax,%r14
jl     11b0 <main+0x80>
movsd  0x0(%r13),%xmm0
movsd  (%r12),%xmm1
movsd  %xmm0,0x0(%r13,%rax,8)
movsd  %xmm1,(%r12,%rax,8)
test   %eax,%eax
mov    -0x38(%rbp),%r14
xorpd  %xmm2,%xmm2
jle    1267 <main+0x137>
xorpd  %xmm3,%xmm3
xor    %ebx,%ebx
xorpd  %xmm2,%xmm2
jmp    1230 <main+0x100>
nopw   0x0(%rax,%rax,1)
movsd  %xmm2,-0x40(%rbp)
call   1050 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  -0x40(%rbp),%xmm2
addsd  %xmm0,%xmm2
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jge    1267 <main+0x137>
movsd  0x0(%r13,%rbx,8),%xmm0
subsd  0x8(%r13,%rbx,8),%xmm0
movsd  (%r12,%rbx,8),%xmm1
subsd  0x8(%r12,%rbx,8),%xmm1
add    $0x1,%rbx
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm3,%xmm0
jb     1210 <main+0xe0>
sqrtsd %xmm0,%xmm0
jmp    1223 <main+0xf3>
movsd  -0x48(%rbp),%xmm0
mulsd  0xd8c(%rip),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
lea    0xd94(%rip),%rdi
call   1030 <printf@plt>
mov    %r14,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [7 x i8] c"%.02lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, double* %3)
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %4
%16 = alloca double, i64 %14
store i64 %14, i64* %5
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
%19 = zext i32 %18 to i64
%20 = alloca double, i64 %19
store i64 %19, i64* %6
store double 0.000000e+00, double* %7
store i32 0, i32* %9
br label %21
21: ; preds = %33, %0
%22 = load i32, i32* %9
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %36
25: ; preds = %21
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %16, i64 %27
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %20, i64 %30
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %28, double* %31)
br label %33
33: ; preds = %25
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %21
36: ; preds = %21
%37 = getelementptr inbounds double, double* %16, i64 0
%38 = load double, double* %37
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %16, i64 %40
store double %38, double* %41
%42 = getelementptr inbounds double, double* %20, i64 0
%43 = load double, double* %42
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %20, i64 %45
store double %43, double* %46
store i32 0, i32* %10
br label %47
47: ; preds = %98, %36
%48 = load i32, i32* %10
%49 = load i32, i32* %2
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %101
51: ; preds = %47
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %16, i64 %53
%55 = load double, double* %54
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %16, i64 %58
%60 = load double, double* %59
%61 = fsub double %55, %60
%62 = load i32, i32* %10
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %16, i64 %63
%65 = load double, double* %64
%66 = load i32, i32* %10
%67 = add nsw i32 %66, 1
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %16, i64 %68
%70 = load double, double* %69
%71 = fsub double %65, %70
%72 = load i32, i32* %10
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %20, i64 %73
%75 = load double, double* %74
%76 = load i32, i32* %10
%77 = add nsw i32 %76, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %20, i64 %78
%80 = load double, double* %79
%81 = fsub double %75, %80
%82 = load i32, i32* %10
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %20, i64 %83
%85 = load double, double* %84
%86 = load i32, i32* %10
%87 = add nsw i32 %86, 1
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %20, i64 %88
%90 = load double, double* %89
%91 = fsub double %85, %90
%92 = fmul double %81, %91
%93 = call double @llvm.fmuladd.f64(double %61, double %71, double %92)
%94 = call double @sqrt(double %93)
store double %94, double* %8
%95 = load double, double* %8
%96 = load double, double* %7
%97 = fadd double %96, %95
store double %97, double* %7
br label %98
98: ; preds = %51
%99 = load i32, i32* %10
%100 = add nsw i32 %99, 1
store i32 %100, i32* %10
br label %47
101: ; preds = %47
%102 = load double, double* %3
%103 = fmul double 0x400921FAFC8B007A, %102
%104 = load double, double* %7
%105 = call double @llvm.fmuladd.f64(double %103, double 2.000000e+00, double %104)
store double %105, double* %7
%106 = load double, double* %7
%107 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %106)
store i32 0, i32* %1
%108 = load i8*, i8** %4
%109 = load i32, i32* %1
ret i32 %109
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [7 x i8] c"%.02lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, double* %2)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
%10 = alloca double, i64 %8
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
%13 = zext i32 %12 to i64
%14 = alloca double, i64 %13
%15 = icmp sgt i32 %11, 0
br i1 %15, label %23, label %32
16: ; preds = %23
%17 = sext i32 %29 to i64
%18 = load double, double* %10
%19 = load double, double* %14
%20 = getelementptr inbounds double, double* %10, i64 %17
store double %18, double* %20
%21 = getelementptr inbounds double, double* %14, i64 %17
store double %19, double* %21
%22 = icmp sgt i32 %29, 0
br i1 %22, label %38, label %32
23: ; preds = %0, %23
%24 = phi i64 [ %28, %23 ], [ 0, %0 ]
%25 = getelementptr inbounds double, double* %10, i64 %24
%26 = getelementptr inbounds double, double* %14, i64 %24
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %25, double* %26)
%28 = add nuw nsw i64 %24, 1
%29 = load i32, i32* %1
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %23, label %16
32: ; preds = %38, %0, %16
%33 = phi double [ 0.000000e+00, %16 ], [ 0.000000e+00, %0 ], [ %55, %38 ]
%34 = load double, double* %2
%35 = fmul double %34, 0x400921FAFC8B007A
%36 = call double @llvm.fmuladd.f64(double %35, double 2.000000e+00, double %33)
%37 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %36)
ret i32 0
38: ; preds = %16, %38
%39 = phi i64 [ %43, %38 ], [ 0, %16 ]
%40 = phi double [ %55, %38 ], [ 0.000000e+00, %16 ]
%41 = getelementptr inbounds double, double* %10, i64 %39
%42 = load double, double* %41
%43 = add nuw nsw i64 %39, 1
%44 = getelementptr inbounds double, double* %10, i64 %43
%45 = load double, double* %44
%46 = fsub double %42, %45
%47 = getelementptr inbounds double, double* %14, i64 %39
%48 = load double, double* %47
%49 = getelementptr inbounds double, double* %14, i64 %43
%50 = load double, double* %49
%51 = fsub double %48, %50
%52 = fmul double %51, %51
%53 = call double @llvm.fmuladd.f64(double %46, double %46, double %52)
%54 = call double @sqrt(double %53)
%55 = fadd double %40, %54
%56 = load i32, i32* %1
%57 = sext i32 %56 to i64
%58 = icmp slt i64 %43, %57
br i1 %58, label %38, label %32
}