#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 */
int /*<<< orphan*/ printf(char *, ...);
void Print_histo(float bin_maxes[], int bin_counts[], int bin_count,
                 float min_meas) {
  int i, j;
  float bin_max, bin_min;
  for (i = 0; i < bin_count; i++) {
    bin_max = bin_maxes[i];
    bin_min = (i == 0) ? min_meas : bin_maxes[i - 1];
    printf("%.3f-%.3f:\t", bin_min, bin_max);
    for (j = 0; j < bin_counts[i]; j++)
      printf("X");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<Print_histo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fa <Print_histo+0xea>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x24(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1166 <Print_histo+0x56>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    117d <Print_histo+0x6d>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe60(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    11de <Print_histo+0xce>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ae <Print_histo+0x9e>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112f <Print_histo+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_histo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
test   %edx,%edx
jle    11b6 <Print_histo+0x96>
mov    %rsi,%r13
mov    %rdi,%r14
mov    %edx,%r12d
xor    %ebx,%ebx
lea    0xeb5(%rip),%r15
jmp    1163 <Print_histo+0x43>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r12,%rbx
je     11b6 <Print_histo+0x96>
movss  0x4(%rsp),%xmm0
test   %rbx,%rbx
je     1175 <Print_histo+0x55>
movss  -0x4(%r14,%rbx,4),%xmm0
movss  (%r14,%rbx,4),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    %r15,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
cmpl   $0x0,0x0(%r13,%rbx,4)
jle    1150 <Print_histo+0x30>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x58,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x0(%r13,%rbx,4),%ebp
jl     11a0 <Print_histo+0x80>
jmp    1150 <Print_histo+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%.3f-%.3f:\09\00"
@.str.1 = [2 x i8] c"X\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @Print_histo(float* %0, i32* %1, i32 %2, float %3) {
%5 = alloca float*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
%12 = alloca float
store float* %0, float** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store float %3, float* %8
store i32 0, i32* %9
br label %13
13: ; preds = %56, %4
%14 = load i32, i32* %9
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %59
17: ; preds = %13
%18 = load float*, float** %5
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %18, i64 %20
%22 = load float, float* %21
store float %22, float* %11
%23 = load i32, i32* %9
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %17
%26 = load float, float* %8
br label %34
27: ; preds = %17
%28 = load float*, float** %5
%29 = load i32, i32* %9
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %28, i64 %31
%33 = load float, float* %32
br label %34
34: ; preds = %27, %25
%35 = phi float [ %26, %25 ], [ %33, %27 ]
store float %35, float* %12
%36 = load float, float* %12
%37 = fpext float %36 to double
%38 = load float, float* %11
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %37, double %39)
store i32 0, i32* %10
br label %41
41: ; preds = %51, %34
%42 = load i32, i32* %10
%43 = load i32*, i32** %6
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = icmp slt i32 %42, %47
br i1 %48, label %49, label %54
49: ; preds = %41
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %51
51: ; preds = %49
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %41
54: ; preds = %41
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %13
59: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%.3f-%.3f:\09\00"
define void @Print_histo(float* nocapture %0, i32* nocapture %1, i32 %2, float %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %35
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %31
%9 = phi i64 [ 0, %6 ], [ %33, %31 ]
%10 = getelementptr inbounds float, float* %0, i64 %9
%11 = load float, float* %10
%12 = icmp eq i64 %9, 0
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = add nsw i64 %9, -1
%15 = getelementptr inbounds float, float* %0, i64 %14
%16 = load float, float* %15
br label %17
17: ; preds = %8, %13
%18 = phi float [ %16, %13 ], [ %3, %8 ]
%19 = fpext float %18 to double
%20 = fpext float %11 to double
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %19, double %20)
%22 = getelementptr inbounds i32, i32* %1, i64 %9
%23 = load i32, i32* %22
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %17, %25
%26 = phi i32 [ %28, %25 ], [ 0, %17 ]
%27 = tail call i32 @putchar(i32 88)
%28 = add nuw nsw i32 %26, 1
%29 = load i32, i32* %22
%30 = icmp slt i32 %28, %29
br i1 %30, label %25, label %31
31: ; preds = %25, %17
%32 = tail call i32 @putchar(i32 10)
%33 = add nuw nsw i64 %9, 1
%34 = icmp eq i64 %33, %7
br i1 %34, label %35, label %8
35: ; preds = %31, %4
ret void
}