#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 rand();
float generate_task_length() {
  float short_long_choice = rand();
  float length = rand();
  if ((short_long_choice / RAND_MAX) > 0.8) {
    return (length / RAND_MAX * (250 - 100) + 100);
  } else {
    return (length / RAND_MAX * (20 - 3) + 3);
  }
}


x86 assembly (clang, -O0):
<generate_task_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
mov    0x2eac(%rip),%rax
divss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1188 <generate_task_length+0x78>
movss  -0xc(%rbp),%xmm0
mov    0x2e86(%rip),%rax
divss  (%rax),%xmm0
movss  0xea2(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe9a(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b5 <generate_task_length+0xa5>
movss  -0xc(%rbp),%xmm0
mov    0x2e54(%rip),%rax
divss  (%rax),%xmm0
movss  0xe68(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe60(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_task_length>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ebc(%rip),%rax
movss  (%rax),%xmm1
movss  0x4(%rsp),%xmm2
divss  %xmm1,%xmm2
cvtss2sd %xmm2,%xmm2
ucomisd 0xeba(%rip),%xmm2
divss  %xmm1,%xmm0
ja     115e <generate_task_length+0x4e>
mulss  0xebc(%rip),%xmm0
addss  0xeb8(%rip),%xmm0
pop    %rax
ret
mulss  0xea2(%rip),%xmm0
addss  0xe9e(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global float 0.000000e+00
define float @generate_task_length() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = call float (...) @rand()
store float %4, float* %2
%5 = call float (...) @rand()
store float %5, float* %3
%6 = load float, float* %2
%7 = load float, float* @RAND_MAX
%8 = fdiv float %6, %7
%9 = fpext float %8 to double
%10 = fcmp ogt double %9, 8.000000e-01
br i1 %10, label %11, label %16
11: ; preds = %0
%12 = load float, float* %3
%13 = load float, float* @RAND_MAX
%14 = fdiv float %12, %13
%15 = call float @llvm.fmuladd.f32(float %14, float 1.500000e+02, float 1.000000e+02)
store float %15, float* %1
br label %21
16: ; preds = %0
%17 = load float, float* %3
%18 = load float, float* @RAND_MAX
%19 = fdiv float %17, %18
%20 = call float @llvm.fmuladd.f32(float %19, float 1.700000e+01, float 3.000000e+00)
store float %20, float* %1
br label %21
21: ; preds = %16, %11
%22 = load float, float* %1
ret float %22
}

LLVM IR (-O2):
@RAND_MAX = global float 0.000000e+00
define float @generate_task_length() {
%1 = tail call float (...) @rand()
%2 = tail call float (...) @rand()
%3 = load float, float* @RAND_MAX
%4 = fdiv float %1, %3
%5 = fpext float %4 to double
%6 = fcmp ogt double %5, 8.000000e-01
%7 = fdiv float %2, %3
%8 = tail call float @llvm.fmuladd.f32(float %7, float 1.500000e+02, float 1.000000e+02)
%9 = tail call float @llvm.fmuladd.f32(float %7, float 1.700000e+01, float 3.000000e+00)
%10 = select i1 %6, float %8, float %9
ret float %10
}