#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 copysignf(float, float);
float fabsf(float);
float xmin2s(float s, float a, float b) {
  float sa = copysignf(s, a);
  float sb = copysignf(s, b);
  float abs_a = fabsf(a);
  float abs_b = fabsf(b);
  float min_abs = (abs_a < abs_b ? abs_a : abs_b);
  return (sa + sb) * min_abs;
}


x86 assembly (clang, -O0):
<xmin2s>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movaps 0xeec(%rip),%xmm2
pand   %xmm2,%xmm1
movaps 0xed1(%rip),%xmm2
pand   %xmm2,%xmm0
por    %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movaps 0xec3(%rip),%xmm2
pand   %xmm2,%xmm1
movaps 0xea8(%rip),%xmm2
pand   %xmm2,%xmm0
por    %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movaps 0xe8f(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movaps 0xe7a(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11b1 <xmin2s+0xb1>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11bb <xmin2s+0xbb>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmin2s>:
movaps 0xef9(%rip),%xmm3
movaps %xmm3,%xmm4
andnps %xmm1,%xmm4
andps  %xmm3,%xmm0
orps   %xmm0,%xmm4
movaps %xmm3,%xmm5
andnps %xmm2,%xmm5
orps   %xmm5,%xmm0
andps  %xmm3,%xmm1
andps  %xmm3,%xmm2
minss  %xmm2,%xmm1
addss  %xmm4,%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @xmin2s(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%12 = load float, float* %4
%13 = load float, float* %5
%14 = call float @llvm.copysign.f32(float %12, float %13)
store float %14, float* %7
%15 = load float, float* %4
%16 = load float, float* %6
%17 = call float @llvm.copysign.f32(float %15, float %16)
store float %17, float* %8
%18 = load float, float* %5
%19 = call float @llvm.fabs.f32(float %18)
store float %19, float* %9
%20 = load float, float* %6
%21 = call float @llvm.fabs.f32(float %20)
store float %21, float* %10
%22 = load float, float* %9
%23 = load float, float* %10
%24 = fcmp olt float %22, %23
br i1 %24, label %25, label %27
25: ; preds = %3
%26 = load float, float* %9
br label %29
27: ; preds = %3
%28 = load float, float* %10
br label %29
29: ; preds = %27, %25
%30 = phi float [ %26, %25 ], [ %28, %27 ]
store float %30, float* %11
%31 = load float, float* %7
%32 = load float, float* %8
%33 = fadd float %31, %32
%34 = load float, float* %11
%35 = fmul float %33, %34
ret float %35
}

LLVM IR (-O2):
define float @xmin2s(float %0, float %1, float %2) {
%4 = tail call float @llvm.copysign.f32(float %0, float %1)
%5 = tail call float @llvm.copysign.f32(float %0, float %2)
%6 = tail call float @llvm.fabs.f32(float %1)
%7 = tail call float @llvm.fabs.f32(float %2)
%8 = fcmp olt float %6, %7
%9 = select i1 %8, float %6, float %7
%10 = fadd float %4, %5
%11 = fmul float %10, %9
ret float %11
}