#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 RAND_MAX;
float floorf(float);
scalar_t__ rand();
float randomTenth(short lowerBound, short upperBound) {
  float x;
  x = (float)rand() / (float)(RAND_MAX / (float)(upperBound - lowerBound));
  x += (float)lowerBound;
  x *= 10.0;
  x = floorf(x);
  x /= 10.0;
  return x;
}


x86 assembly (clang, -O0):
<randomTenth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
xor    %eax,%eax
call   1040 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2e9f(%rip),%rax
movss  (%rax),%xmm1
movswl -0x4(%rbp),%eax
movswl -0x2(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm2
divss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movswl -0x2(%rbp),%eax
cvtsi2ss %eax,%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe75(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe48(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomTenth>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
cvtsi2ss %rax,%xmm1
mov    0x2eae(%rip),%rax
movss  (%rax),%xmm2
sub    %ebp,%ebx
cvtsi2ss %ebx,%xmm0
divss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
mulss  0xea1(%rip),%xmm0
call   1030 <floorf@plt>
divss  0xe94(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global float 0.000000e+00
define float @randomTenth(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca float
store i16 %0, i16* %3
store i16 %1, i16* %4
%6 = call i64 (...) @rand()
%7 = sitofp i64 %6 to float
%8 = load float, float* @RAND_MAX
%9 = load i16, i16* %4
%10 = sext i16 %9 to i32
%11 = load i16, i16* %3
%12 = sext i16 %11 to i32
%13 = sub nsw i32 %10, %12
%14 = sitofp i32 %13 to float
%15 = fdiv float %8, %14
%16 = fdiv float %7, %15
store float %16, float* %5
%17 = load i16, i16* %3
%18 = sitofp i16 %17 to float
%19 = load float, float* %5
%20 = fadd float %19, %18
store float %20, float* %5
%21 = load float, float* %5
%22 = fpext float %21 to double
%23 = fmul double %22, 1.000000e+01
%24 = fptrunc double %23 to float
store float %24, float* %5
%25 = load float, float* %5
%26 = call float @llvm.floor.f32(float %25)
store float %26, float* %5
%27 = load float, float* %5
%28 = fpext float %27 to double
%29 = fdiv double %28, 1.000000e+01
%30 = fptrunc double %29 to float
store float %30, float* %5
%31 = load float, float* %5
ret float %31
}

LLVM IR (-O2):
@RAND_MAX = global float 0.000000e+00
define float @randomTenth(i16 signext %0, i16 signext %1) {
%3 = tail call i64 (...) @rand()
%4 = sitofp i64 %3 to float
%5 = load float, float* @RAND_MAX
%6 = sext i16 %1 to i32
%7 = sext i16 %0 to i32
%8 = sub nsw i32 %6, %7
%9 = sitofp i32 %8 to float
%10 = fdiv float %5, %9
%11 = fdiv float %4, %10
%12 = sitofp i16 %0 to float
%13 = fadd float %11, %12
%14 = fmul float %13, 1.000000e+01
%15 = tail call float @llvm.floor.f32(float %14)
%16 = fdiv float %15, 1.000000e+01
ret float %16
}