#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 */
scalar_t__ find_dist(float, float, float, float);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n, i;
  float r, dist_curr, dist = 0;
  float num1_curr, num1_prev, num1_init;
  float num2_curr, num2_prev, num2_init;
  scanf("%d %f", &n, &r);
  scanf("%f %f", &num1_prev, &num2_prev);
  if (n == 1) {
    printf("%0.2f", 2 * 3.14159 * r);
    return 0;
  }
  num1_init = num1_prev;
  num2_init = num2_prev;
  for (i = 0; i < n - 1; i++) {
    scanf("%f %f", &num1_curr, &num2_curr);
    dist += find_dist(num1_curr, num2_curr, num1_prev, num2_prev);
    num1_prev = num1_curr;
    num2_prev = num2_curr;
  }
  dist += find_dist(num1_curr, num2_curr, num1_init, num2_init);
  dist += 2 * 3.14159 * r;
  printf("%0.2f", dist);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11ae <main+0x7e>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe72(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12a5 <main+0x175>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    123a <main+0x10a>
lea    0xe2d(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
movss  -0x1c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm3
call   1030 <find_dist@plt>
cvtsi2ss %rax,%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c9 <main+0x99>
movss  -0x1c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
movss  -0x30(%rbp),%xmm3
call   1030 <find_dist@plt>
cvtsi2ss %rax,%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xd84(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xd7b(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xec7(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x1,0x1c(%rsp)
jne    1188 <main+0x58>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe7d(%rip),%xmm0
jmp    1268 <main+0x138>
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x24(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm0
movss  %xmm0,0x20(%rsp)
lea    0xe5e(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
call   1030 <find_dist@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x14(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm1
movss  %xmm1,0x8(%rsp)
add    $0x1,%ebp
mov    0x1c(%rsp),%eax
add    $0xffffffff,%eax
cmp    %eax,%ebp
jl     11c0 <main+0x90>
movss  0x24(%rsp),%xmm2
movss  0x20(%rsp),%xmm3
call   1030 <find_dist@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  0xd9c(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xda1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %f\00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [6 x i8] c"%0.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %6
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, float* %4)
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %8, float* %11)
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %23
17: ; preds = %0
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = fmul double 6.283180e+00, %19
%21 = fptrunc double %20 to float
%22 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), float %21)
store i32 0, i32* %1
br label %63
23: ; preds = %0
%24 = load float, float* %8
store float %24, float* %9
%25 = load float, float* %11
store float %25, float* %12
store i32 0, i32* %3
br label %26
26: ; preds = %43, %23
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, 1
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %46
31: ; preds = %26
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %7, float* %10)
%33 = load float, float* %7
%34 = load float, float* %10
%35 = load float, float* %8
%36 = load float, float* %11
%37 = call i64 @find_dist(float %33, float %34, float %35, float %36)
%38 = sitofp i64 %37 to float
%39 = load float, float* %6
%40 = fadd float %39, %38
store float %40, float* %6
%41 = load float, float* %7
store float %41, float* %8
%42 = load float, float* %10
store float %42, float* %11
br label %43
43: ; preds = %31
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %26
46: ; preds = %26
%47 = load float, float* %7
%48 = load float, float* %10
%49 = load float, float* %9
%50 = load float, float* %12
%51 = call i64 @find_dist(float %47, float %48, float %49, float %50)
%52 = sitofp i64 %51 to float
%53 = load float, float* %6
%54 = fadd float %53, %52
store float %54, float* %6
%55 = load float, float* %4
%56 = fpext float %55 to double
%57 = load float, float* %6
%58 = fpext float %57 to double
%59 = call double @llvm.fmuladd.f64(double 6.283180e+00, double %56, double %58)
%60 = fptrunc double %59 to float
store float %60, float* %6
%61 = load float, float* %6
%62 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), float %61)
store i32 0, i32* %1
br label %63
63: ; preds = %46, %17
%64 = load i32, i32* %1
ret i32 %64
}

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