#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 qdist3(float x, float y, float z) {
  float ans;
  { assert(x >= 0.0F); };
  { assert(y >= 0.0F); };
  { assert(z >= 0.0F); };
  if (x > y) {
    if (x > z) {
      ans = x + (y + z) * 0.2941F;
      return ans;
    }
  } else {
    if (y > z) {
      ans = y + (x + z) * 0.2941F;
      return ans;
    }
  }
  ans = z + (x + y) * 0.2941F;
  return ans;
}


x86 assembly (clang, -O0):
<qdist3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11c5 <qdist3+0xb5>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11c0 <qdist3+0xb0>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  0xe5c(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    123a <qdist3+0x12a>
jmp    120c <qdist3+0xfc>
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1207 <qdist3+0xf7>
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  0xe15(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    123a <qdist3+0x12a>
jmp    120c <qdist3+0xfc>
movss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  0xddd(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qdist3>:
sub    $0x18,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
xorps  %xmm1,%xmm1
xor    %edi,%edi
ucomiss %xmm1,%xmm0
setae  %dil
call   1030 <assert@plt>
xor    %edi,%edi
movss  0x10(%rsp),%xmm0
ucomiss 0xebe(%rip),%xmm0
setae  %dil
call   1030 <assert@plt>
xor    %edi,%edi
movss  0xc(%rsp),%xmm0
ucomiss 0xea6(%rip),%xmm0
setae  %dil
call   1030 <assert@plt>
movss  0x10(%rsp),%xmm1
movss  0x14(%rsp),%xmm0
ucomiss %xmm1,%xmm0
jbe    119b <qdist3+0x8b>
movss  0xc(%rsp),%xmm2
ucomiss %xmm2,%xmm0
jbe    11bb <qdist3+0xab>
addss  %xmm2,%xmm1
mulss  0xe71(%rip),%xmm1
addss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x18,%rsp
ret
movss  0xc(%rsp),%xmm2
ucomiss %xmm2,%xmm1
jbe    11bb <qdist3+0xab>
addss  %xmm2,%xmm0
mulss  0xe4e(%rip),%xmm0
addss  %xmm1,%xmm0
add    $0x18,%rsp
ret
addss  %xmm1,%xmm0
mulss  0xe39(%rip),%xmm0
addss  %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @qdist3(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%9 = load float, float* %5
%10 = fcmp oge float %9, 0.000000e+00
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load float, float* %6
%14 = fcmp oge float %13, 0.000000e+00
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load float, float* %7
%18 = fcmp oge float %17, 0.000000e+00
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load float, float* %5
%22 = load float, float* %6
%23 = fcmp ogt float %21, %22
br i1 %23, label %24, label %36
24: ; preds = %3
%25 = load float, float* %5
%26 = load float, float* %7
%27 = fcmp ogt float %25, %26
br i1 %27, label %28, label %35
28: ; preds = %24
%29 = load float, float* %5
%30 = load float, float* %6
%31 = load float, float* %7
%32 = fadd float %30, %31
%33 = call float @llvm.fmuladd.f32(float %32, float 0x3FD2D288C0000000, float %29)
store float %33, float* %8
%34 = load float, float* %8
store float %34, float* %4
br label %55
35: ; preds = %24
br label %48
36: ; preds = %3
%37 = load float, float* %6
%38 = load float, float* %7
%39 = fcmp ogt float %37, %38
br i1 %39, label %40, label %47
40: ; preds = %36
%41 = load float, float* %6
%42 = load float, float* %5
%43 = load float, float* %7
%44 = fadd float %42, %43
%45 = call float @llvm.fmuladd.f32(float %44, float 0x3FD2D288C0000000, float %41)
store float %45, float* %8
%46 = load float, float* %8
store float %46, float* %4
br label %55
47: ; preds = %36
br label %48
48: ; preds = %47, %35
%49 = load float, float* %7
%50 = load float, float* %5
%51 = load float, float* %6
%52 = fadd float %50, %51
%53 = call float @llvm.fmuladd.f32(float %52, float 0x3FD2D288C0000000, float %49)
store float %53, float* %8
%54 = load float, float* %8
store float %54, float* %4
br label %55
55: ; preds = %48, %40, %28
%56 = load float, float* %4
ret float %56
}

LLVM IR (-O2):
define float @qdist3(float %0, float %1, float %2) {
%4 = fcmp oge float %0, 0.000000e+00
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = fcmp oge float %1, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = fcmp oge float %2, 0.000000e+00
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = fcmp ogt float %0, %1
br i1 %13, label %14, label %19
14: ; preds = %3
%15 = fcmp ogt float %0, %2
br i1 %15, label %16, label %24
16: ; preds = %14
%17 = fadd float %1, %2
%18 = tail call float @llvm.fmuladd.f32(float %17, float 0x3FD2D288C0000000, float %0)
br label %27
19: ; preds = %3
%20 = fcmp ogt float %1, %2
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = fadd float %0, %2
%23 = tail call float @llvm.fmuladd.f32(float %22, float 0x3FD2D288C0000000, float %1)
br label %27
24: ; preds = %19, %14
%25 = fadd float %0, %1
%26 = tail call float @llvm.fmuladd.f32(float %25, float 0x3FD2D288C0000000, float %2)
br label %27
27: ; preds = %24, %21, %16
%28 = phi float [ %18, %16 ], [ %26, %24 ], [ %23, %21 ]
ret float %28
}