#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void star_bar_plot(FILE *pfile, double y, double yscale) {
  int jj, ypos;
  int columns = 80;
  char matrix[80 + 1];
  for (jj = 1; jj <= columns; jj++) {
    if (jj % 5 != 0)
      matrix[jj] = '.';
    else
      matrix[jj] = '|';
  }
  ypos = 1 + (int)((double)(columns - 1) * y / yscale);
  if (ypos > columns)
    ypos = columns;
  if (ypos < 1)
    ypos = 1;
  ypos = columns - ypos + 1;
  for (jj = 1; jj <= ypos; jj++)
    matrix[jj] = '*';
  for (jj = 1; jj <= columns; jj++)
    fprintf(pfile, "%c", matrix[jj]);
  fprintf(pfile, "\n");
  return;
}


x86 assembly (clang, -O0):
<star_bar_plot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movl   $0x50,-0x24(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1181 <star_bar_plot+0x71>
mov    -0x1c(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1165 <star_bar_plot+0x55>
movslq -0x1c(%rbp),%rax
movb   $0x2e,-0x80(%rbp,%rax,1)
jmp    116e <star_bar_plot+0x5e>
movslq -0x1c(%rbp),%rax
movb   $0x7c,-0x80(%rbp,%rax,1)
jmp    1173 <star_bar_plot+0x63>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <star_bar_plot+0x27>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    11b1 <star_bar_plot+0xa1>
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jge    11c2 <star_bar_plot+0xb2>
movl   $0x1,-0x20(%rbp)
mov    -0x24(%rbp),%eax
sub    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     11f8 <star_bar_plot+0xe8>
movslq -0x1c(%rbp),%rax
movb   $0x2a,-0x80(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d5 <star_bar_plot+0xc5>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1234 <star_bar_plot+0x124>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edx
lea    0xde1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ff <star_bar_plot+0xef>
mov    -0x8(%rbp),%rdi
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<star_bar_plot>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%r14
lea    0x1(%rsp),%rdi
movaps 0xeca(%rip),%xmm2
movups %xmm2,0x1(%rsp)
movaps 0xece(%rip),%xmm2
movups %xmm2,0x11(%rsp)
movaps 0xed2(%rip),%xmm2
movups %xmm2,0x21(%rsp)
movaps 0xed6(%rip),%xmm2
movups %xmm2,0x31(%rsp)
mulsd  0xee9(%rip),%xmm0
movaps 0xed2(%rip),%xmm2
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movups %xmm2,0x41(%rsp)
lea    0x1(%rax),%ecx
cmp    $0x50,%eax
mov    $0x50,%eax
cmovl  %ecx,%eax
test   %eax,%eax
mov    $0x1,%ecx
cmovg  %eax,%ecx
mov    $0x51,%edx
sub    %ecx,%edx
mov    $0x2a,%esi
call   1030 <memset@plt>
mov    $0x1,%ebx
nopl   0x0(%rax)
movsbl (%rsp,%rbx,1),%edi
mov    %r14,%rsi
call   1040 <fputc@plt>
add    $0x1,%rbx
cmp    $0x51,%rbx
jne    11b0 <star_bar_plot+0x90>
mov    $0xa,%edi
mov    %r14,%rsi
add    $0x58,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fputc@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @star_bar_plot(i32* %0, double %1, double %2) {
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [81 x i8]
store i32* %0, i32** %4
store double %1, double* %5
store double %2, double* %6
store i32 80, i32* %9
store i32 1, i32* %7
br label %11
11: ; preds = %28, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %9
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i32, i32* %7
%17 = srem i32 %16, 5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [81 x i8], [81 x i8]* %10, i64 0, i64 %21
store i8 46, i8* %22
br label %27
23: ; preds = %15
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [81 x i8], [81 x i8]* %10, i64 0, i64 %25
store i8 124, i8* %26
br label %27
27: ; preds = %23, %19
br label %28
28: ; preds = %27
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %11
31: ; preds = %11
%32 = load i32, i32* %9
%33 = sub nsw i32 %32, 1
%34 = sitofp i32 %33 to double
%35 = load double, double* %5
%36 = fmul double %34, %35
%37 = load double, double* %6
%38 = fdiv double %36, %37
%39 = fptosi double %38 to i32
%40 = add nsw i32 1, %39
store i32 %40, i32* %8
%41 = load i32, i32* %8
%42 = load i32, i32* %9
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %31
%45 = load i32, i32* %9
store i32 %45, i32* %8
br label %46
46: ; preds = %44, %31
%47 = load i32, i32* %8
%48 = icmp slt i32 %47, 1
br i1 %48, label %49, label %50
49: ; preds = %46
store i32 1, i32* %8
br label %50
50: ; preds = %49, %46
%51 = load i32, i32* %9
%52 = load i32, i32* %8
%53 = sub nsw i32 %51, %52
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
store i32 1, i32* %7
br label %55
55: ; preds = %63, %50
%56 = load i32, i32* %7
%57 = load i32, i32* %8
%58 = icmp sle i32 %56, %57
br i1 %58, label %59, label %66
59: ; preds = %55
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [81 x i8], [81 x i8]* %10, i64 0, i64 %61
store i8 42, i8* %62
br label %63
63: ; preds = %59
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %55
66: ; preds = %55
store i32 1, i32* %7
br label %67
67: ; preds = %79, %66
%68 = load i32, i32* %7
%69 = load i32, i32* %9
%70 = icmp sle i32 %68, %69
br i1 %70, label %71, label %82
71: ; preds = %67
%72 = load i32*, i32** %4
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [81 x i8], [81 x i8]* %10, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %71
%80 = load i32, i32* %7
%81 = add nsw i32 %80, 1
store i32 %81, i32* %7
br label %67
82: ; preds = %67
%83 = load i32*, i32** %4
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @star_bar_plot(i32* nocapture %0, double %1, double %2) {
%4 = alloca [81 x i8]
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 1
%7 = bitcast i8* %6 to <16 x i8>*
store <16 x i8> <i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46>, <16 x i8>* %7
%8 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 17
%9 = bitcast i8* %8 to <16 x i8>*
store <16 x i8> <i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46>, <16 x i8>* %9
%10 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 33
%11 = bitcast i8* %10 to <16 x i8>*
store <16 x i8> <i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46>, <16 x i8>* %11
%12 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 49
%13 = bitcast i8* %12 to <16 x i8>*
store <16 x i8> <i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46>, <16 x i8>* %13
%14 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 65
%15 = bitcast i8* %14 to <16 x i8>*
store <16 x i8> <i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124, i8 46, i8 46, i8 46, i8 46, i8 124>, <16 x i8>* %15
%16 = fmul double %1, 7.900000e+01
%17 = fdiv double %16, %2
%18 = fptosi double %17 to i32
%19 = add nsw i32 %18, 1
%20 = icmp slt i32 %18, 80
%21 = select i1 %20, i32 %19, i32 80
%22 = icmp sgt i32 %21, 1
%23 = select i1 %22, i32 %21, i32 1
%24 = sub nuw nsw i32 81, %23
%25 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 1
%26 = zext i32 %24 to i64
br label %27
27: ; preds = %3, %27
%28 = phi i64 [ 1, %3 ], [ %33, %27 ]
%29 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = tail call i32 @fputc(i32 %31, i32* %0)
%33 = add nuw nsw i64 %28, 1
%34 = icmp eq i64 %33, 81
br i1 %34, label %35, label %27
35: ; preds = %27
%36 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}