#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 */
struct VariableDensity {
  int dummy;
};

/* Variables and functions */
float getFinalScale(struct VariableDensity const *);
int /*<<< orphan*/ memcpy(float *, float const *, int);
int /*<<< orphan*/ scalefloats(float *, int, float);
void getFinalFieldOfView(const struct VariableDensity *variableDensity,
                         const float *initialFieldOfView,
                         float *finalFieldOfView, int dimensions) {
  float scale = getFinalScale(variableDensity);
  memcpy(finalFieldOfView, initialFieldOfView, dimensions * sizeof(float));
  scalefloats(finalFieldOfView, dimensions, scale);
}


x86 assembly (clang, -O0):
<getFinalFieldOfView>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getFinalScale@plt>
movss  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
movss  -0x20(%rbp),%xmm0
call   1030 <scalefloats@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFinalFieldOfView>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%r15
call   1040 <getFinalScale@plt>
movss  %xmm0,0xc(%rsp)
lea    0x0(,%r14,4),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
movss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <scalefloats@plt>

LLVM IR (-O0):
%struct.VariableDensity = type { i32 }
define void @getFinalFieldOfView(%struct.VariableDensity* %0, float* %1, float* %2, i32 %3) {
%5 = alloca %struct.VariableDensity*
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca float
store %struct.VariableDensity* %0, %struct.VariableDensity** %5
store float* %1, float** %6
store float* %2, float** %7
store i32 %3, i32* %8
%10 = load %struct.VariableDensity*, %struct.VariableDensity** %5
%11 = call float @getFinalScale(%struct.VariableDensity* %10)
store float %11, float* %9
%12 = load float*, float** %7
%13 = load float*, float** %6
%14 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 4
%17 = trunc i64 %16 to i32
%18 = call i32 @memcpy(float* %12, float* %13, i32 %17)
%19 = load float*, float** %7
%20 = load i32, i32* %8
%21 = load float, float* %9
%22 = call i32 @scalefloats(float* %19, i32 %20, float %21)
ret void
}

LLVM IR (-O2):
%struct.VariableDensity = type { i32 }
define void @getFinalFieldOfView(%struct.VariableDensity* %0, float* %1, float* %2, i32 %3) {
%5 = tail call float @getFinalScale(%struct.VariableDensity* %0)
%6 = shl i32 %3, 2
%7 = tail call i32 @memcpy(float* %2, float* %1, i32 %6)
%8 = tail call i32 @scalefloats(float* %2, i32 %3, float %5)
ret void
}