#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 *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int barrels_num, i, pac_mass = 1;
  float pac_coordinate_x = 0, pac_coordinate_y = 0, barrels_coordinate_x[20],
        barrels_coordinate_y[20], vector_length_x, vector_length_y;
  printf("The desired number of nacepin barrels? :\n");
  scanf("%d", &barrels_num);
  for (i = 1; i <= barrels_num; i++) {
    printf("Please input the x and y coordinates of nacepin barrel %d:", i);
    printf("\n");
    scanf("%f %f", &barrels_coordinate_x[i], &barrels_coordinate_y[i]);
  }
  for (i = 1; i <= barrels_num; i++) {
    vector_length_x = (barrels_coordinate_x[i] - pac_coordinate_x) +
                      (barrels_coordinate_x[i] - pac_coordinate_x) / pac_mass;
    vector_length_y = (barrels_coordinate_y[i] - pac_coordinate_y) +
                      (barrels_coordinate_y[i] - pac_coordinate_y) / pac_mass;
    printf("%.1f %.1f\n", vector_length_x, vector_length_y);
    pac_mass *= 2;
    pac_coordinate_x += vector_length_x;
    pac_coordinate_y += vector_length_y;
    printf("%d\n", pac_mass);
  }
  printf("%.1f %.1f\n", pac_coordinate_x, pac_coordinate_y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d8 <main+0xb8>
mov    -0xc(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
lea    -0x70(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
lea    -0xc0(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <main+0x50>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12c9 <main+0x1a9>
movslq -0xc(%rbp),%rax
movss  -0x70(%rbp,%rax,4),%xmm0
subss  -0x14(%rbp),%xmm0
movslq -0xc(%rbp),%rax
movss  -0x70(%rbp,%rax,4),%xmm1
subss  -0x14(%rbp),%xmm1
cvtsi2ssl -0x10(%rbp),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc4(%rbp)
ff
movslq -0xc(%rbp),%rax
movss  -0xc0(%rbp,%rax,4),%xmm0
ff ff
subss  -0x18(%rbp),%xmm0
movslq -0xc(%rbp),%rax
movss  -0xc0(%rbp,%rax,4),%xmm1
ff ff
subss  -0x18(%rbp),%xmm1
cvtsi2ssl -0x10(%rbp),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc8(%rbp)
ff
movss  -0xc4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xc8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
lea    0xdf8(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
movss  -0xc4(%rbp),%xmm0
ff
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc8(%rbp),%xmm0
ff
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11df <main+0xbf>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd8c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
lea    0xefb(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9c(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
cmpl   $0x0,0xc(%rsp)
jle    1282 <main+0x142>
lea    0x34(%rsp),%r14
lea    0x84(%rsp),%r13
lea    0xe71(%rip),%r15
lea    0xea5(%rip),%r12
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
movslq 0xc(%rsp),%rax
add    $0x4,%r14
add    $0x4,%r13
cmp    %rax,%rbx
jl     11a0 <main+0x60>
test   %eax,%eax
xorps  %xmm0,%xmm0
jle    1282 <main+0x142>
xorps  %xmm1,%xmm1
mov    $0x1,%ebp
lea    0xe4e(%rip),%r14
lea    0xe52(%rip),%r15
xor    %ebx,%ebx
nop
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movaps %xmm1,%xmm3
movaps %xmm1,0x20(%rsp)
movss  0x34(%rsp,%rbx,4),%xmm1
movss  0x84(%rsp,%rbx,4),%xmm2
unpcklps %xmm1,%xmm2
subps  %xmm3,%xmm2
shufps $0x0,%xmm0,%xmm0
movaps %xmm2,%xmm1
divps  %xmm0,%xmm1
addps  %xmm2,%xmm1
movaps %xmm1,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
shufps $0x55,%xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
mov    %r14,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
add    %ebp,%ebp
movaps 0x10(%rsp),%xmm0
addps  0x20(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movaps 0x10(%rsp),%xmm1
movslq 0xc(%rsp),%rax
add    $0x1,%rbx
cmp    %rax,%rbx
jl     1200 <main+0xc0>
cvtps2pd %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
lea    0xdb4(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"The desired number of nacepin barrels? :\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [59 x i8] c"Please input the x and y coordinates of nacepin barrel %d:\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [6 x i8] c"%f %f\00"
@.str.5 = [11 x i8] c"%.1f %.1f\0A\00"
@.str.6 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca [20 x float]
%8 = alloca [20 x float]
%9 = alloca float
%10 = alloca float
store i32 0, i32* %1
store i32 1, i32* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %13
13: ; preds = %28, %0
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %31
17: ; preds = %13
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x float], [20 x float]* %7, i64 0, i64 %22
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [20 x float], [20 x float]* %8, i64 0, i64 %25
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), float* %23, float* %26)
br label %28
28: ; preds = %17
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %13
31: ; preds = %13
store i32 1, i32* %3
br label %32
32: ; preds = %84, %31
%33 = load i32, i32* %3
%34 = load i32, i32* %2
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %87
36: ; preds = %32
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [20 x float], [20 x float]* %7, i64 0, i64 %38
%40 = load float, float* %39
%41 = load float, float* %5
%42 = fsub float %40, %41
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [20 x float], [20 x float]* %7, i64 0, i64 %44
%46 = load float, float* %45
%47 = load float, float* %5
%48 = fsub float %46, %47
%49 = load i32, i32* %4
%50 = sitofp i32 %49 to float
%51 = fdiv float %48, %50
%52 = fadd float %42, %51
store float %52, float* %9
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [20 x float], [20 x float]* %8, i64 0, i64 %54
%56 = load float, float* %55
%57 = load float, float* %6
%58 = fsub float %56, %57
%59 = load i32, i32* %3
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [20 x float], [20 x float]* %8, i64 0, i64 %60
%62 = load float, float* %61
%63 = load float, float* %6
%64 = fsub float %62, %63
%65 = load i32, i32* %4
%66 = sitofp i32 %65 to float
%67 = fdiv float %64, %66
%68 = fadd float %58, %67
store float %68, float* %10
%69 = load float, float* %9
%70 = fpext float %69 to double
%71 = load float, float* %10
%72 = fpext float %71 to double
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), double %70, double %72)
%74 = load i32, i32* %4
%75 = mul nsw i32 %74, 2
store i32 %75, i32* %4
%76 = load float, float* %9
%77 = load float, float* %5
%78 = fadd float %77, %76
store float %78, float* %5
%79 = load float, float* %10
%80 = load float, float* %6
%81 = fadd float %80, %79
store float %81, float* %6
%82 = load i32, i32* %4
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %82)
br label %84
84: ; preds = %36
%85 = load i32, i32* %3
%86 = add nsw i32 %85, 1
store i32 %86, i32* %3
br label %32
87: ; preds = %32
%88 = load float, float* %5
%89 = fpext float %88 to double
%90 = load float, float* %6
%91 = fpext float %90 to double
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), double %89, double %91)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [59 x i8] c"Please input the x and y coordinates of nacepin barrel %d:\00"
@.str.4 = [6 x i8] c"%f %f\00"
@.str.5 = [11 x i8] c"%.1f %.1f\0A\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@str = [41 x i8] c"The desired number of nacepin barrels? :\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x float]
%3 = alloca [20 x float]
%4 = bitcast i32* %1 to i8*
%5 = bitcast [20 x float]* %2 to i8*
%6 = bitcast [20 x float]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 1
br i1 %10, label %55, label %13
11: ; preds = %13
%12 = icmp slt i32 %22, 1
br i1 %12, label %55, label %25
13: ; preds = %0, %13
%14 = phi i64 [ %21, %13 ], [ 1, %0 ]
%15 = trunc i64 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @putchar(i32 10)
%18 = getelementptr inbounds [20 x float], [20 x float]* %2, i64 0, i64 %14
%19 = getelementptr inbounds [20 x float], [20 x float]* %3, i64 0, i64 %14
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), float* %18, float* %19)
%21 = add nuw nsw i64 %14, 1
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %14, %23
br i1 %24, label %13, label %11
25: ; preds = %11, %25
%26 = phi i64 [ %49, %25 ], [ 1, %11 ]
%27 = phi i32 [ %46, %25 ], [ 1, %11 ]
%28 = phi <2 x float> [ %47, %25 ], [ zeroinitializer, %11 ]
%29 = getelementptr inbounds [20 x float], [20 x float]* %2, i64 0, i64 %26
%30 = load float, float* %29
%31 = sitofp i32 %27 to float
%32 = getelementptr inbounds [20 x float], [20 x float]* %3, i64 0, i64 %26
%33 = load float, float* %32
%34 = insertelement <2 x float> poison, float %30, i64 0
%35 = insertelement <2 x float> %34, float %33, i64 1
%36 = fsub <2 x float> %35, %28
%37 = insertelement <2 x float> poison, float %31, i64 0
%38 = shufflevector <2 x float> %37, <2 x float> poison, <2 x i32> zeroinitializer
%39 = fdiv <2 x float> %36, %38
%40 = fadd <2 x float> %36, %39
%41 = extractelement <2 x float> %40, i64 0
%42 = fpext float %41 to double
%43 = extractelement <2 x float> %40, i64 1
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), double %42, double %44)
%46 = shl nsw i32 %27, 1
%47 = fadd <2 x float> %28, %40
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %46)
%49 = add nuw nsw i64 %26, 1
%50 = load i32, i32* %1
%51 = sext i32 %50 to i64
%52 = icmp slt i64 %26, %51
br i1 %52, label %25, label %53
53: ; preds = %25
%54 = fpext <2 x float> %47 to <2 x double>
br label %55
55: ; preds = %0, %53, %11
%56 = phi <2 x double> [ zeroinitializer, %11 ], [ %54, %53 ], [ zeroinitializer, %0 ]
%57 = extractelement <2 x double> %56, i64 0
%58 = extractelement <2 x double> %56, i64 1
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), double %57, double %58)
ret i32 0
}