#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, double, double, int, double, char);
int /*<<< orphan*/ stdout;
void output_histogram_1(int interval, double less_than_this[], int count[1024],
                        int total_count) {
  int i;
  for (i = 0; i < 1024; i++) {
    if (count[i]) {
      printf("%s %7.2lf =< %7.2lf\t%5d which is %5.2lf%c\n", ".results",
             less_than_this[i] - interval, less_than_this[i], count[i],
             (total_count == 0)
                 ? 0.0
                 : (double)count[i] / (double)total_count * 100.0,
             '%');
      fflush(stdout);
    }
  }
}


x86 assembly (clang, -O0):
<output_histogram_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x400,-0x20(%rbp)
jge    1220 <output_histogram_1+0x100>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     120d <output_histogram_1+0xed>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11ae <output_histogram_1+0x8e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11d5 <output_histogram_1+0xb5>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe34(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x24(%rbp),%edx
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
lea    0xe1a(%rip),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x25,%ecx
call   1030 <printf@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    1212 <output_histogram_1+0xf2>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113d <output_histogram_1+0x1d>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_histogram_1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ecx,%r13d
mov    %rdx,%rbx
mov    %rsi,%r14
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %ebp,%ebp
lea    0xedc(%rip),%r12
mov    0x2e82(%rip),%r15
jmp    11ae <output_histogram_1+0x8e>
xorps  %xmm2,%xmm2
cvtsi2sd %edx,%xmm2
divsd  0x8(%rsp),%xmm2
mulsd  0xe8b(%rip),%xmm2
movsd  (%r14,%rbp,8),%xmm1
movapd %xmm1,%xmm0
subsd  0x10(%rsp),%xmm0
lea    0xe7c(%rip),%rdi
mov    %r12,%rsi
mov    $0x25,%ecx
call   1030 <printf@plt>
mov    (%r15),%edi
call   1040 <fflush@plt>
add    $0x1,%rbp
cmp    $0x400,%rbp
je     11c0 <output_histogram_1+0xa0>
mov    (%rbx,%rbp,4),%edx
test   %edx,%edx
je     11a1 <output_histogram_1+0x81>
test   %r13d,%r13d
jne    1160 <output_histogram_1+0x40>
xorpd  %xmm2,%xmm2
jmp    1175 <output_histogram_1+0x55>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"%s %7.2lf =< %7.2lf\09%5d which is %5.2lf%c\0A\00"
@.str.1 = [9 x i8] c".results\00"
@stdout = global i32 0
define void @output_histogram_1(i32 %0, double* %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store double* %1, double** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %59, %4
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 1024
br i1 %12, label %13, label %62
13: ; preds = %10
%14 = load i32*, i32** %7
%15 = load i32, i32* %9
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %58
20: ; preds = %13
%21 = load double*, double** %6
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to double
%28 = fsub double %25, %27
%29 = load double*, double** %6
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = load i32*, i32** %7
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = load i32, i32* %8
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %20
br label %53
42: ; preds = %20
%43 = load i32*, i32** %7
%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 = sitofp i32 %47 to double
%49 = load i32, i32* %8
%50 = sitofp i32 %49 to double
%51 = fdiv double %48, %50
%52 = fmul double %51, 1.000000e+02
br label %53
53: ; preds = %42, %41
%54 = phi double [ 0.000000e+00, %41 ], [ %52, %42 ]
%55 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %28, double %33, i32 %38, double %54, i8 signext 37)
%56 = load i32, i32* @stdout
%57 = call i32 @fflush(i32 %56)
br label %58
58: ; preds = %53, %13
br label %59
59: ; preds = %58
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %10
62: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"%s %7.2lf =< %7.2lf\09%5d which is %5.2lf%c\0A\00"
@.str.1 = [9 x i8] c".results\00"
@stdout = global i32 0
define void @output_histogram_1(i32 %0, double* nocapture %1, i32* nocapture %2, i32 %3) {
%5 = sitofp i32 %0 to double
%6 = icmp eq i32 %3, 0
%7 = sitofp i32 %3 to double
br label %8
8: ; preds = %4, %26
%9 = phi i64 [ 0, %4 ], [ %27, %26 ]
%10 = getelementptr inbounds i32, i32* %2, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %26, label %13
13: ; preds = %8
%14 = getelementptr inbounds double, double* %1, i64 %9
%15 = load double, double* %14
%16 = fsub double %15, %5
br i1 %6, label %21, label %17
17: ; preds = %13
%18 = sitofp i32 %11 to double
%19 = fdiv double %18, %7
%20 = fmul double %19, 1.000000e+02
br label %21
21: ; preds = %13, %17
%22 = phi double [ %20, %17 ], [ 0.000000e+00, %13 ]
%23 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %16, double %15, i32 %11, double %22, i8 signext 37)
%24 = load i32, i32* @stdout
%25 = tail call i32 @fflush(i32 %24)
br label %26
26: ; preds = %8, %21
%27 = add nuw nsw i64 %9, 1
%28 = icmp eq i64 %27, 1024
br i1 %28, label %29, label %8
29: ; preds = %26
ret void
}