#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 */
float fabs(float);
int get_nchan_from_depth(int);
float get_diagonal_dm_simple(float nu1, float nu2, float dt, int depth) {
  float d1 = 1.0 / nu1 / nu1;
  float d2 = 1.0 / nu2 / nu2;
  int nchan = get_nchan_from_depth(depth);
  float dm_max = dt / 4148.8 / ((d2 - d1) / nchan);
  return fabs(dm_max);
}


x86 assembly (clang, -O0):
<get_diagonal_dm_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
divsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe92(%rip),%xmm0
divsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <get_nchan_from_depth@plt>
mov    %eax,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe54(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
cvtsi2ssl -0x1c(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_diagonal_dm_simple>:
sub    $0x28,%rsp
movss  %xmm2,0xc(%rsp)
unpcklps %xmm0,%xmm1
cvtps2pd %xmm1,%xmm0
movapd 0xed8(%rip),%xmm1
divpd  %xmm0,%xmm1
divpd  %xmm0,%xmm1
cvtpd2ps %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
call   1030 <get_nchan_from_depth@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xecf(%rip),%xmm0
movaps 0x10(%rsp),%xmm3
movaps %xmm3,%xmm1
shufps $0x55,%xmm3,%xmm1
xorps  %xmm2,%xmm2
cvtsi2ss %eax,%xmm2
subss  %xmm1,%xmm3
divss  %xmm2,%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
andps  0xe8e(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @get_diagonal_dm_simple(float %0, float %1, float %2, i32 %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store i32 %3, i32* %8
%13 = load float, float* %5
%14 = fpext float %13 to double
%15 = fdiv double 1.000000e+00, %14
%16 = load float, float* %5
%17 = fpext float %16 to double
%18 = fdiv double %15, %17
%19 = fptrunc double %18 to float
store float %19, float* %9
%20 = load float, float* %6
%21 = fpext float %20 to double
%22 = fdiv double 1.000000e+00, %21
%23 = load float, float* %6
%24 = fpext float %23 to double
%25 = fdiv double %22, %24
%26 = fptrunc double %25 to float
store float %26, float* %10
%27 = load i32, i32* %8
%28 = call i32 @get_nchan_from_depth(i32 %27)
store i32 %28, i32* %11
%29 = load float, float* %7
%30 = fpext float %29 to double
%31 = fdiv double %30, 4.148800e+03
%32 = load float, float* %10
%33 = load float, float* %9
%34 = fsub float %32, %33
%35 = load i32, i32* %11
%36 = sitofp i32 %35 to float
%37 = fdiv float %34, %36
%38 = fpext float %37 to double
%39 = fdiv double %31, %38
%40 = fptrunc double %39 to float
store float %40, float* %12
%41 = load float, float* %12
%42 = call float @fabs(float %41)
ret float %42
}

LLVM IR (-O2):
define float @get_diagonal_dm_simple(float %0, float %1, float %2, i32 %3) {
%5 = insertelement <2 x float> poison, float %1, i64 0
%6 = insertelement <2 x float> %5, float %0, i64 1
%7 = fpext <2 x float> %6 to <2 x double>
%8 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %7
%9 = fdiv <2 x double> %8, %7
%10 = fptrunc <2 x double> %9 to <2 x float>
%11 = tail call i32 @get_nchan_from_depth(i32 %3)
%12 = fpext float %2 to double
%13 = fdiv double %12, 4.148800e+03
%14 = shufflevector <2 x float> %10, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%15 = fsub <2 x float> %10, %14
%16 = extractelement <2 x float> %15, i64 0
%17 = sitofp i32 %11 to float
%18 = fdiv float %16, %17
%19 = fpext float %18 to double
%20 = fdiv double %13, %19
%21 = fptrunc double %20 to float
%22 = tail call float @llvm.fabs.f32(float %21)
ret float %22
}