#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 */
typedef scalar_t__ int64_t;

/* Variables and functions */
scalar_t__ now();
int /*<<< orphan*/ printf(char *, int);
void results(int i, int64_t time, int msg_size) {
  int64_t dif_time = (now() - time);
  float rate = ((float)(i + 1) * 1000) / ((float)dif_time);
  printf("Rate: %f msgs per second.\n", rate);
  printf("Length : %d\n", msg_size);
  printf("Msgs received: %d\n", i);
}


x86 assembly (clang, -O0):
<results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1040 <now@plt>
sub    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  0xead(%rip),%xmm1
mulss  %xmm1,%xmm0
cvtsi2ssq -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
cvttss2si -0x24(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<results>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <now@plt>
lea    0x1(%rbx),%ecx
cvtsi2ss %ecx,%xmm0
mulss  0xebe(%rip),%xmm0
sub    %rbp,%rax
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Rate: %f msgs per second.\0A\00"
@.str.1 = [13 x i8] c"Length : %d\0A\00"
@.str.2 = [19 x i8] c"Msgs received: %d\0A\00"
define void @results(i32 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
%8 = alloca float
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%9 = call i64 (...) @now()
%10 = load i64, i64* %5
%11 = sub nsw i64 %9, %10
store i64 %11, i64* %7
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = sitofp i32 %13 to float
%15 = fmul float %14, 1.000000e+03
%16 = load i64, i64* %7
%17 = sitofp i64 %16 to float
%18 = fdiv float %15, %17
store float %18, float* %8
%19 = load float, float* %8
%20 = fptosi float %19 to i32
%21 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %6
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %4
%25 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Rate: %f msgs per second.\0A\00"
@.str.1 = [13 x i8] c"Length : %d\0A\00"
@.str.2 = [19 x i8] c"Msgs received: %d\0A\00"
define void @results(i32 %0, i64 %1, i32 %2) {
%4 = tail call i64 (...) @now()
%5 = sub nsw i64 %4, %1
%6 = add nsw i32 %0, 1
%7 = sitofp i32 %6 to float
%8 = fmul float %7, 1.000000e+03
%9 = sitofp i64 %5 to float
%10 = fdiv float %8, %9
%11 = fptosi float %10 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %0)
ret void
}