#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, int);
float rand();
int time_hours(float);
int time_milliseconds(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("%02d:%02d:%02d,%03d", time_hours(r), time_minutes(r), time_seconds(r),
         time_milliseconds(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,-0x20(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
movss  -0x20(%rbp),%xmm1
mov    0x2e57(%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   1060 <time_hours@plt>
mov    %eax,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <time_minutes@plt>
mov    %eax,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
call   1070 <time_seconds@plt>
mov    %eax,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1050 <time_milliseconds@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    %eax,%r8d
lea    0xdff(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_time>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    0x2e5f(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm1,%xmm0
addss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
addss  (%rbx),%xmm1
movss  %xmm1,(%rbx)
call   1060 <time_hours@plt>
mov    %eax,%r14d
movss  0x8(%rsp),%xmm0
call   1030 <time_minutes@plt>
mov    %eax,%ebp
movss  0x8(%rsp),%xmm0
call   1070 <time_seconds@plt>
mov    %eax,%ebx
movss  0x8(%rsp),%xmm0
call   1050 <time_milliseconds@plt>
lea    0xe1c(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [20 x i8] c"%02d:%02d:%02d,%03d\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_hours(float %18)
%20 = load float, float* %5
%21 = call i32 @time_minutes(float %20)
%22 = load float, float* %5
%23 = call i32 @time_seconds(float %22)
%24 = load float, float* %5
%25 = call i32 @time_milliseconds(float %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %21, i32 %23, i32 %25)
ret void
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [20 x i8] c"%02d:%02d:%02d,%03d\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_hours(float %8)
%12 = tail call i32 @time_minutes(float %8)
%13 = tail call i32 @time_seconds(float %8)
%14 = tail call i32 @time_milliseconds(float %8)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13, i32 %14)
ret void
}