#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 */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
void print_results(int *vet, int bins, double min, double h,
                   struct timeval start, struct timeval end) {
  for (int i = 0; i <= bins; i++) {
    printf("%.2lf%c", min + i * h, i == bins ? '\n' : ' ');
  }
  for (int i = 0; i < bins; i++) {
    printf("%d%c", vet[i], i == (bins - 1) ? '\n' : ' ');
  }
  int duration = ((end.tv_sec * 1000000 + end.tv_usec) -
                  (start.tv_sec * 1000000 + start.tv_usec));
  printf("%d\n", duration);
}


x86 assembly (clang, -O0):
<print_results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdx,-0x8(%rbp)
mov    %rcx,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1190 <print_results+0x80>
movsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x34(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    -0x34(%rbp),%ecx
mov    -0x1c(%rbp),%edi
mov    $0x20,%edx
mov    $0xa,%eax
cmp    %edi,%ecx
cmove  %eax,%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1138 <print_results+0x28>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e2 <print_results+0xd2>
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x38(%rbp),%ecx
mov    -0x1c(%rbp),%edi
sub    $0x1,%edi
mov    $0x20,%edx
mov    $0xa,%eax
cmp    %edi,%ecx
cmove  %eax,%edx
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1197 <print_results+0x87>
imul   $0xf4240,-0x10(%rbp),%eax
add    -0xc(%rbp),%eax
imul   $0xf4240,-0x8(%rbp),%ecx
add    -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_results>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,0x10(%rsp)
mov    %rdx,0x8(%rsp)
test   %esi,%esi
js     11e3 <print_results+0xd3>
mov    %esi,%ebx
mov    %rdi,%r12
lea    0x1(%rbx),%ebp
mov    $0xa,%r14d
lea    0xebb(%rip),%r13
xor    %r15d,%r15d
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorps  %xmm2,%xmm2
cvtsi2sd %r15d,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
cvttsd2si %xmm2,%esi
cmp    %r15d,%ebx
mov    $0x20,%edx
cmove  %r14d,%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
add    $0x1,%r15d
cmp    %r15d,%ebp
jne    1160 <print_results+0x50>
test   %ebx,%ebx
jle    11e3 <print_results+0xd3>
lea    -0x1(%rbx),%r13d
mov    %ebx,%ebx
mov    $0xa,%r15d
lea    0xe52(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,4),%esi
cmp    %rbp,%r13
mov    $0x20,%edx
cmove  %r15d,%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11c0 <print_results+0xb0>
mov    0x10(%rsp),%rcx
mov    %rcx,%rsi
shr    $0x20,%rsi
mov    0x8(%rsp),%rdx
mov    %rdx,%rax
shr    $0x20,%rax
sub    %edx,%ecx
imul   $0xf4240,%ecx,%ecx
sub    %eax,%esi
add    %ecx,%esi
lea    0xdff(%rip),%rdi
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [8 x i8] c"%.2lf%c\00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @print_results(i32* %0, i32 %1, double %2, double %3, i64 %4, i64 %5) {
%7 = alloca %struct.timeval
%8 = alloca %struct.timeval
%9 = alloca i32*
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = bitcast %struct.timeval* %7 to i64*
store i64 %4, i64* %16
%17 = bitcast %struct.timeval* %8 to i64*
store i64 %5, i64* %17
store i32* %0, i32** %9
store i32 %1, i32* %10
store double %2, double* %11
store double %3, double* %12
store i32 0, i32* %13
br label %18
18: ; preds = %35, %6
%19 = load i32, i32* %13
%20 = load i32, i32* %10
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load double, double* %11
%24 = load i32, i32* %13
%25 = sitofp i32 %24 to double
%26 = load double, double* %12
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double %23)
%28 = fptosi double %27 to i32
%29 = load i32, i32* %13
%30 = load i32, i32* %10
%31 = icmp eq i32 %29, %30
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 10, i32 32
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %33)
br label %35
35: ; preds = %22
%36 = load i32, i32* %13
%37 = add nsw i32 %36, 1
store i32 %37, i32* %13
br label %18
38: ; preds = %18
store i32 0, i32* %14
br label %39
39: ; preds = %56, %38
%40 = load i32, i32* %14
%41 = load i32, i32* %10
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %59
43: ; preds = %39
%44 = load i32*, i32** %9
%45 = load i32, i32* %14
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
%49 = load i32, i32* %14
%50 = load i32, i32* %10
%51 = sub nsw i32 %50, 1
%52 = icmp eq i32 %49, %51
%53 = zext i1 %52 to i64
%54 = select i1 %52, i32 10, i32 32
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %48, i32 %54)
br label %56
56: ; preds = %43
%57 = load i32, i32* %14
%58 = add nsw i32 %57, 1
store i32 %58, i32* %14
br label %39
59: ; preds = %39
%60 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%61 = load i32, i32* %60
%62 = mul nsw i32 %61, 1000000
%63 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%64 = load i32, i32* %63
%65 = add nsw i32 %62, %64
%66 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%67 = load i32, i32* %66
%68 = mul nsw i32 %67, 1000000
%69 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%70 = load i32, i32* %69
%71 = add nsw i32 %68, %70
%72 = sub nsw i32 %65, %71
store i32 %72, i32* %15
%73 = load i32, i32* %15
%74 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %73)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%.2lf%c\00"
@.str.1 = [5 x i8] c"%d%c\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @print_results(i32* nocapture %0, i32 %1, double %2, double %3, i64 %4, i64 %5) {
%7 = icmp slt i32 %1, 0
br i1 %7, label %24, label %14
8: ; preds = %14
%9 = icmp sgt i32 %1, 0
br i1 %9, label %10, label %24
10: ; preds = %8
%11 = add nsw i32 %1, -1
%12 = zext i32 %11 to i64
%13 = zext i32 %1 to i64
br label %36
14: ; preds = %6, %14
%15 = phi i32 [ %22, %14 ], [ 0, %6 ]
%16 = sitofp i32 %15 to double
%17 = tail call double @llvm.fmuladd.f64(double %16, double %3, double %2)
%18 = fptosi double %17 to i32
%19 = icmp eq i32 %15, %1
%20 = select i1 %19, i32 10, i32 32
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %20)
%22 = add nuw i32 %15, 1
%23 = icmp eq i32 %15, %1
br i1 %23, label %8, label %14
24: ; preds = %36, %6, %8
%25 = lshr i64 %5, 32
%26 = trunc i64 %25 to i32
%27 = trunc i64 %5 to i32
%28 = lshr i64 %4, 32
%29 = trunc i64 %28 to i32
%30 = trunc i64 %4 to i32
%31 = sub i32 %27, %30
%32 = mul i32 %31, 1000000
%33 = sub i32 %26, %29
%34 = add i32 %33, %32
%35 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
ret void
36: ; preds = %10, %36
%37 = phi i64 [ 0, %10 ], [ %43, %36 ]
%38 = getelementptr inbounds i32, i32* %0, i64 %37
%39 = load i32, i32* %38
%40 = icmp eq i64 %37, %12
%41 = select i1 %40, i32 10, i32 32
%42 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %39, i32 %41)
%43 = add nuw nsw i64 %37, 1
%44 = icmp eq i64 %43, %13
br i1 %44, label %24, label %36
}