#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 sqrtf(double);
double f__cabsf(float real, float imag) {
  float temp;
  if (real < 0.0f)
    real = -real;
  if (imag < 0.0f)
    imag = -imag;
  if (imag > real) {
    temp = real;
    real = imag;
    imag = temp;
  }
  if ((imag + real) == real)
    return ((float)real);
  temp = imag / real;
  temp = real * sqrtf(1.0 + temp * temp);
  return (temp);
}


x86 assembly (clang, -O0):
<f__cabsf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1146 <f__cabsf+0x36>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    116a <f__cabsf+0x5a>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1197 <f__cabsf+0x87>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jne    11c4 <f__cabsf+0xb4>
jp     11c4 <f__cabsf+0xb4>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121b <f__cabsf+0x10b>
movss  -0x10(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe0d(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f__cabsf>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm3
movaps %xmm0,%xmm4
xorps  %xmm3,%xmm4
xorps  %xmm5,%xmm5
movaps %xmm0,%xmm2
cmpltss %xmm5,%xmm2
andps  %xmm2,%xmm4
andnps %xmm0,%xmm2
orps   %xmm4,%xmm2
xorps  %xmm1,%xmm3
movaps %xmm1,%xmm0
cmpltss %xmm5,%xmm0
andps  %xmm0,%xmm3
andnps %xmm1,%xmm0
orps   %xmm3,%xmm0
movaps %xmm0,%xmm1
maxss  %xmm2,%xmm1
minss  %xmm0,%xmm2
movaps %xmm2,%xmm0
addss  %xmm1,%xmm0
ucomiss %xmm1,%xmm0
jne    1162 <f__cabsf+0x52>
jnp    118a <f__cabsf+0x7a>
divss  %xmm1,%xmm2
mulss  %xmm2,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
addsd  0xe97(%rip),%xmm0
movaps %xmm1,(%rsp)
call   1030 <sqrtf@plt>
movaps (%rsp),%xmm1
mulss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @f__cabsf(float %0, float %1) {
%3 = alloca double
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
%7 = load float, float* %4
%8 = fcmp olt float %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load float, float* %4
%11 = fneg float %10
store float %11, float* %4
br label %12
12: ; preds = %9, %2
%13 = load float, float* %5
%14 = fcmp olt float %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load float, float* %5
%17 = fneg float %16
store float %17, float* %5
br label %18
18: ; preds = %15, %12
%19 = load float, float* %5
%20 = load float, float* %4
%21 = fcmp ogt float %19, %20
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load float, float* %4
store float %23, float* %6
%24 = load float, float* %5
store float %24, float* %4
%25 = load float, float* %6
store float %25, float* %5
br label %26
26: ; preds = %22, %18
%27 = load float, float* %5
%28 = load float, float* %4
%29 = fadd float %27, %28
%30 = load float, float* %4
%31 = fcmp oeq float %29, %30
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load float, float* %4
%34 = fpext float %33 to double
store double %34, double* %3
br label %49
35: ; preds = %26
%36 = load float, float* %5
%37 = load float, float* %4
%38 = fdiv float %36, %37
store float %38, float* %6
%39 = load float, float* %4
%40 = load float, float* %6
%41 = load float, float* %6
%42 = fmul float %40, %41
%43 = fpext float %42 to double
%44 = fadd double 1.000000e+00, %43
%45 = call float @sqrtf(double %44)
%46 = fmul float %39, %45
store float %46, float* %6
%47 = load float, float* %6
%48 = fpext float %47 to double
store double %48, double* %3
br label %49
49: ; preds = %35, %32
%50 = load double, double* %3
ret double %50
}

LLVM IR (-O2):
define double @f__cabsf(float %0, float %1) {
%3 = fcmp olt float %0, 0.000000e+00
%4 = fneg float %0
%5 = select i1 %3, float %4, float %0
%6 = fcmp olt float %1, 0.000000e+00
%7 = fneg float %1
%8 = select i1 %6, float %7, float %1
%9 = fcmp ogt float %8, %5
%10 = select i1 %9, float %8, float %5
%11 = select i1 %9, float %5, float %8
%12 = fadd float %11, %10
%13 = fcmp oeq float %12, %10
br i1 %13, label %21, label %14
14: ; preds = %2
%15 = fdiv float %11, %10
%16 = fmul float %15, %15
%17 = fpext float %16 to double
%18 = fadd double %17, 1.000000e+00
%19 = tail call float @sqrtf(double %18)
%20 = fmul float %10, %19
br label %21
21: ; preds = %2, %14
%22 = phi float [ %20, %14 ], [ %10, %2 ]
%23 = fpext float %22 to double
ret double %23
}