#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 */
int /*<<< orphan*/ assert(int);
float qdist2(float x, float y) {
  float ans;
  { assert(x >= 0.0F); };
  { assert(y >= 0.0F); };
  if (x > y) {
    ans = x + y * 0.5F;
  } else {
    ans = y + x * 0.5F;
  }
  return ans;
}


x86 assembly (clang, -O0):
<qdist2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1185 <qdist2+0x75>
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
movss  0xe8d(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11a4 <qdist2+0x94>
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  0xe69(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qdist2>:
sub    $0x28,%rsp
movaps %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
xorps  %xmm1,%xmm1
xor    %edi,%edi
ucomiss %xmm1,%xmm0
setae  %dil
call   1030 <assert@plt>
xor    %edi,%edi
movaps 0x10(%rsp),%xmm0
ucomiss 0xec6(%rip),%xmm0
setae  %dil
call   1030 <assert@plt>
movss  0xeb1(%rip),%xmm0
movaps 0x10(%rsp),%xmm2
movaps %xmm2,%xmm1
mulss  %xmm0,%xmm1
movss  0xc(%rsp),%xmm3
addss  %xmm3,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm2,%xmm0
cmpltss %xmm3,%xmm2
andps  %xmm2,%xmm1
andnps %xmm0,%xmm2
orps   %xmm1,%xmm2
movaps %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @qdist2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = fcmp oge float %6, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load float, float* %4
%11 = fcmp oge float %10, 0.000000e+00
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load float, float* %3
%15 = load float, float* %4
%16 = fcmp ogt float %14, %15
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load float, float* %3
%19 = load float, float* %4
%20 = call float @llvm.fmuladd.f32(float %19, float 5.000000e-01, float %18)
store float %20, float* %5
br label %25
21: ; preds = %2
%22 = load float, float* %4
%23 = load float, float* %3
%24 = call float @llvm.fmuladd.f32(float %23, float 5.000000e-01, float %22)
store float %24, float* %5
br label %25
25: ; preds = %21, %17
%26 = load float, float* %5
ret float %26
}

LLVM IR (-O2):
define float @qdist2(float %0, float %1) {
%3 = fcmp oge float %0, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = fcmp oge float %1, 0.000000e+00
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = fcmp ogt float %0, %1
%10 = tail call float @llvm.fmuladd.f32(float %1, float 5.000000e-01, float %0)
%11 = tail call float @llvm.fmuladd.f32(float %0, float 5.000000e-01, float %1)
%12 = select i1 %9, float %10, float %11
ret float %12
}