#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 */
double end_velocity(int, int, double, double);
int /*<<< orphan*/ printf(char *, double);
void down_from(int i, int n, int *dist, int *deg, double g) {
  double velocity = 0;
  for (int j = i; j < n; j++)
    velocity = end_velocity(dist[j], deg[j], g, velocity);
  printf("%.6lf\n", velocity);
}


x86 assembly (clang, -O0):
<down_from>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118d <down_from+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <end_velocity@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1149 <down_from+0x29>
movsd  -0x28(%rbp),%xmm0
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<down_from>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xorps  %xmm1,%xmm1
cmp    %esi,%edi
jge    116e <down_from+0x4e>
mov    %esi,%r15d
movslq %edi,%rax
lea    (%rdx,%rax,4),%r14
lea    (%rcx,%rax,4),%r12
sub    %edi,%r15d
xorps  %xmm1,%xmm1
xor    %ebx,%ebx
movsd  %xmm0,(%rsp)
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
mov    (%r12,%rbx,4),%esi
movsd  (%rsp),%xmm0
call   1030 <end_velocity@plt>
movaps %xmm0,%xmm1
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1150 <down_from+0x30>
lea    0xe8b(%rip),%rdi
movaps %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%.6lf\0A\00"
define void @down_from(i32 %0, i32 %1, i32* %2, i32* %3, double %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca double
%11 = alloca double
%12 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store double %4, double* %10
store double 0.000000e+00, double* %11
%13 = load i32, i32* %6
store i32 %13, i32* %12
br label %14
14: ; preds = %32, %5
%15 = load i32, i32* %12
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %35
18: ; preds = %14
%19 = load i32*, i32** %8
%20 = load i32, i32* %12
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = load i32*, i32** %9
%25 = load i32, i32* %12
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = load double, double* %10
%30 = load double, double* %11
%31 = call double @end_velocity(i32 %23, i32 %28, double %29, double %30)
store double %31, double* %11
br label %32
32: ; preds = %18
%33 = load i32, i32* %12
%34 = add nsw i32 %33, 1
store i32 %34, i32* %12
br label %14
35: ; preds = %14
%36 = load double, double* %11
%37 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %36)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.6lf\0A\00"
define void @down_from(i32 %0, i32 %1, i32* nocapture %2, i32* nocapture %3, double %4) {
%6 = icmp slt i32 %0, %1
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = sext i32 %0 to i64
br label %12
9: ; preds = %12, %5
%10 = phi double [ 0.000000e+00, %5 ], [ %19, %12 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %10)
ret void
12: ; preds = %7, %12
%13 = phi i64 [ %8, %7 ], [ %20, %12 ]
%14 = phi double [ 0.000000e+00, %7 ], [ %19, %12 ]
%15 = getelementptr inbounds i32, i32* %2, i64 %13
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %3, i64 %13
%18 = load i32, i32* %17
%19 = tail call double @end_velocity(i32 %16, i32 %18, double %4, double %14)
%20 = add nsw i64 %13, 1
%21 = trunc i64 %20 to i32
%22 = icmp eq i32 %21, %1
br i1 %22, label %9, label %12
}