float bellrand(st, fin)
float st, fin;
{
  float interval;
  float random();
  interval = (fin - st) / 5;
  switch (rand3()) {
  case 1:
    return (random(st, fin));
  case 2:
    return (random(st + interval, fin - interval));
  case 3:
    return (random(st + 2 * interval, fin - 2 * interval));
  default:
    printf("what the hell???\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<bellrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm1,-0x20(%rbp)
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  0xe83(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
xor    %eax,%eax
call   1030 <rand3@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x1,%eax
je     11c2 <bellrand+0x82>
jmp    11a0 <bellrand+0x60>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11e5 <bellrand+0xa5>
jmp    11b1 <bellrand+0x71>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1212 <bellrand+0xd2>
jmp    124f <bellrand+0x10f>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1050 <random@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <bellrand+0x124>
movss  -0x8(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1050 <random@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <bellrand+0x124>
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  %xmm2,%xmm2
subss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1050 <random@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <bellrand+0x124>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bellrand>:
push   %rax
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <rand3@plt>
cmp    $0x1,%eax
je     119a <bellrand+0x5a>
movss  (%rsp),%xmm1
movaps %xmm1,%xmm0
movss  0x4(%rsp),%xmm2
subss  %xmm2,%xmm0
divss  0xe83(%rip),%xmm0
cmp    $0x3,%eax
je     11a7 <bellrand+0x67>
cmp    $0x2,%eax
je     11ab <bellrand+0x6b>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
jmp    11b3 <bellrand+0x73>
addss  %xmm0,%xmm0
addss  %xmm0,%xmm2
subss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
pop    %rcx
jmp    1050 <random@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"what the hell???\0A\00"
define float @bellrand(double %0, double %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = fptrunc double %0 to float
%8 = fptrunc double %1 to float
store float %7, float* %4
store float %8, float* %5
%9 = load float, float* %5
%10 = load float, float* %4
%11 = fsub float %9, %10
%12 = fdiv float %11, 5.000000e+00
store float %12, float* %6
%13 = call i32 (...) @rand3()
switch i32 %13, label %40 [
i32 1, label %14
i32 2, label %20
i32 3, label %30
]
14: ; preds = %2
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = call float (double, double, ...) bitcast (float (...)* @random to float (double, double, ...)*)(double %16, double %18)
store float %19, float* %3
br label %42
20: ; preds = %2
%21 = load float, float* %4
%22 = load float, float* %6
%23 = fadd float %21, %22
%24 = fpext float %23 to double
%25 = load float, float* %5
%26 = load float, float* %6
%27 = fsub float %25, %26
%28 = fpext float %27 to double
%29 = call float (double, double, ...) bitcast (float (...)* @random to float (double, double, ...)*)(double %24, double %28)
store float %29, float* %3
br label %42
30: ; preds = %2
%31 = load float, float* %4
%32 = load float, float* %6
%33 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %32, float %31)
%34 = fpext float %33 to double
%35 = load float, float* %5
%36 = load float, float* %6
%37 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %36, float %35)
%38 = fpext float %37 to double
%39 = call float (double, double, ...) bitcast (float (...)* @random to float (double, double, ...)*)(double %34, double %38)
store float %39, float* %3
br label %42
40: ; preds = %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
unreachable
42: ; preds = %30, %20, %14
%43 = load float, float* %3
ret float %43
}

LLVM IR (-O2):
@str = [17 x i8] c"what the hell???\00"
define float @bellrand(double %0, double %1) {
%3 = fptrunc double %0 to float
%4 = fptrunc double %1 to float
%5 = fsub float %4, %3
%6 = fdiv float %5, 5.000000e+00
%7 = tail call i32 (...) @rand3()
switch i32 %7, label %14 [
i32 1, label %16
i32 2, label %8
i32 3, label %11
]
8: ; preds = %2
%9 = fadd float %6, %3
%10 = fsub float %4, %6
br label %16
11: ; preds = %2
%12 = tail call float @llvm.fmuladd.f32(float %6, float 2.000000e+00, float %3)
%13 = tail call float @llvm.fmuladd.f32(float %6, float -2.000000e+00, float %4)
br label %16
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
16: ; preds = %2, %11, %8
%17 = phi float [ %13, %11 ], [ %10, %8 ], [ %4, %2 ]
%18 = phi float [ %12, %11 ], [ %9, %8 ], [ %3, %2 ]
%19 = fpext float %18 to double
%20 = fpext float %17 to double
%21 = tail call float (double, double, ...) bitcast (float (...)* @random to float (double, double, ...)*)(double %19, double %20)
ret float %21
}