#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 *, int, int, int);
float rand();
int time_centiseconds(float);
int time_minutes(float);
int time_seconds(float);
void gen_time(float *t, float dt) {
  float r = *t + (rand() / (float)RAND_MAX) * dt;
  *t += dt;
  printf("[%d:%02d.%02d]", time_minutes(r), time_seconds(r),
         time_centiseconds(r));
}


x86 assembly (clang, -O0):
<gen_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
movss  -0x1c(%rbp),%xmm1
mov    0x2e67(%rip),%rax
cvtsi2ssq (%rax),%xmm2
divss  %xmm2,%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0x10(%rbp),%xmm0
call   1030 <time_minutes@plt>
mov    %eax,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
call   1060 <time_seconds@plt>
mov    %eax,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <time_centiseconds@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
lea    0xe20(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_time>:
push   %rbp
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
mov    0x2e75(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  0x4(%rsp),%xmm1
mulss  %xmm1,%xmm0
addss  (%rsp),%xmm0
movss  %xmm0,(%rsp)
addss  (%rbx),%xmm1
movss  %xmm1,(%rbx)
call   1030 <time_minutes@plt>
mov    %eax,%ebx
movss  (%rsp),%xmm0
call   1060 <time_seconds@plt>
mov    %eax,%ebp
movss  (%rsp),%xmm0
call   1040 <time_centiseconds@plt>
lea    0xe44(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [15 x i8] c"[%d:%02d.%02d]\00"
define void @gen_time(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
%5 = alloca float
store float* %0, float** %3
store float %1, float* %4
%6 = load float*, float** %3
%7 = load float, float* %6
%8 = call float (...) @rand()
%9 = load i64, i64* @RAND_MAX
%10 = sitofp i64 %9 to float
%11 = fdiv float %8, %10
%12 = load float, float* %4
%13 = call float @llvm.fmuladd.f32(float %11, float %12, float %7)
store float %13, float* %5
%14 = load float, float* %4
%15 = load float*, float** %3
%16 = load float, float* %15
%17 = fadd float %16, %14
store float %17, float* %15
%18 = load float, float* %5
%19 = call i32 @time_minutes(float %18)
%20 = load float, float* %5
%21 = call i32 @time_seconds(float %20)
%22 = load float, float* %5
%23 = call i32 @time_centiseconds(float %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %21, i32 %23)
ret void
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [15 x i8] c"[%d:%02d.%02d]\00"
define void @gen_time(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = tail call float (...) @rand()
%5 = load i64, i64* @RAND_MAX
%6 = sitofp i64 %5 to float
%7 = fdiv float %4, %6
%8 = tail call float @llvm.fmuladd.f32(float %7, float %1, float %3)
%9 = load float, float* %0
%10 = fadd float %9, %1
store float %10, float* %0
%11 = tail call i32 @time_minutes(float %8)
%12 = tail call i32 @time_seconds(float %8)
%13 = tail call i32 @time_centiseconds(float %8)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13)
ret void
}