#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 */
scalar_t__ RAND_MAX;
int /*<<< orphan*/ printf(char *, float);
float rand();
float DeterminarTempoServico(float A, float B, float T0) {
  float r, X;
  r = rand() / (float)RAND_MAX;
  X = T0 + A + (B - A) * r;
  printf("\nTempoServico = %f \n\n", X);
  return X;
}


x86 assembly (clang, -O0):
<DeterminarTempoServico>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    0x2ea3(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm1
addss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DeterminarTempoServico>:
sub    $0x18,%rsp
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
mov    0x2ea4(%rip),%rax
xorps  %xmm1,%xmm1
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  0x14(%rsp),%xmm1
movss  0x10(%rsp),%xmm3
addss  %xmm3,%xmm1
movss  0xc(%rsp),%xmm2
subss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [22 x i8] c"\0ATempoServico = %f \0A\0A\00"
define float @DeterminarTempoServico(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* %4
store float %1, float* %5
store float %2, float* %6
%9 = call float (...) @rand()
%10 = load i64, i64* @RAND_MAX
%11 = sitofp i64 %10 to float
%12 = fdiv float %9, %11
store float %12, float* %7
%13 = load float, float* %6
%14 = load float, float* %4
%15 = fadd float %13, %14
%16 = load float, float* %5
%17 = load float, float* %4
%18 = fsub float %16, %17
%19 = load float, float* %7
%20 = call float @llvm.fmuladd.f32(float %18, float %19, float %15)
store float %20, float* %8
%21 = load float, float* %8
%22 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %21)
%23 = load float, float* %8
ret float %23
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [22 x i8] c"\0ATempoServico = %f \0A\0A\00"
define float @DeterminarTempoServico(float %0, float %1, float %2) {
%4 = tail call float (...) @rand()
%5 = load i64, i64* @RAND_MAX
%6 = sitofp i64 %5 to float
%7 = fdiv float %4, %6
%8 = fadd float %0, %2
%9 = fsub float %1, %0
%10 = tail call float @llvm.fmuladd.f32(float %9, float %7, float %8)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %10)
ret float %10
}