#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 getScale(struct VariableDensity const *, float);
int /*<<< orphan*/ memcpy(float *, float const *, int);
int /*<<< orphan*/ scalefloats(float *, int, float);
void getFieldOfView(const struct VariableDensity *variableDensity, float kr,
                    const float *fieldOfViewInitial, float *fieldOfViewKr,
                    int dimensions) {
  float scale = getScale(variableDensity, kr);
  memcpy(fieldOfViewKr, fieldOfViewInitial, dimensions * sizeof(float));
  scalefloats(fieldOfViewKr, dimensions, scale);
}


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

x86 assembly (clang, -O2):
<getFieldOfView>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%r15
call   1040 <getScale@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 @getFieldOfView(%struct.VariableDensity* %0, float %1, float* %2, float* %3, i32 %4) {
%6 = alloca %struct.VariableDensity*
%7 = alloca float
%8 = alloca float*
%9 = alloca float*
%10 = alloca i32
%11 = alloca float
store %struct.VariableDensity* %0, %struct.VariableDensity** %6
store float %1, float* %7
store float* %2, float** %8
store float* %3, float** %9
store i32 %4, i32* %10
%12 = load %struct.VariableDensity*, %struct.VariableDensity** %6
%13 = load float, float* %7
%14 = call float @getScale(%struct.VariableDensity* %12, float %13)
store float %14, float* %11
%15 = load float*, float** %9
%16 = load float*, float** %8
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = mul i64 %18, 4
%20 = trunc i64 %19 to i32
%21 = call i32 @memcpy(float* %15, float* %16, i32 %20)
%22 = load float*, float** %9
%23 = load i32, i32* %10
%24 = load float, float* %11
%25 = call i32 @scalefloats(float* %22, i32 %23, float %24)
ret void
}

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