#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*/ putchar(char);
void disp_perct_bar(double perct) {
  int i, j;
  int barinc = 5;
  (void)putchar('[');
  for (i = 0; i < perct; i += barinc)
    (void)putchar('#');
  for (j = i; j < 100; j += barinc)
    (void)putchar(' ');
  (void)putchar(']');
}


x86 assembly (clang, -O0):
<disp_perct_bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movl   $0x5,-0x14(%rbp)
mov    $0x5b,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1161 <disp_perct_bar+0x51>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <disp_perct_bar+0x25>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    1189 <disp_perct_bar+0x79>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1167 <disp_perct_bar+0x57>
mov    $0x5d,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disp_perct_bar>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    $0x5b,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    116b <disp_perct_bar+0x5b>
mov    $0xfffffffb,%ebx
nopl   0x0(%rax)
mov    $0x23,%edi
call   1030 <putchar@plt>
lea    0xa(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x5,%ebx
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     1140 <disp_perct_bar+0x30>
cmp    $0x5e,%ebx
ja     1182 <disp_perct_bar+0x72>
add    $0x5,%ebx
add    $0xfffffffb,%ebx
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x5,%ebx
cmp    $0x5f,%ebx
jb     1170 <disp_perct_bar+0x60>
mov    $0x5d,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @disp_perct_bar(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store double %0, double* %2
store i32 5, i32* %5
%6 = call i32 @putchar(i8 signext 91)
store i32 0, i32* %3
br label %7
7: ; preds = %14, %1
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to double
%10 = load double, double* %2
%11 = fcmp olt double %9, %10
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = call i32 @putchar(i8 signext 35)
br label %14
14: ; preds = %12
%15 = load i32, i32* %5
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* %3
store i32 %19, i32* %4
br label %20
20: ; preds = %25, %18
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 100
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = call i32 @putchar(i8 signext 32)
br label %25
25: ; preds = %23
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = add nsw i32 %27, %26
store i32 %28, i32* %4
br label %20
29: ; preds = %20
%30 = call i32 @putchar(i8 signext 93)
ret void
}

LLVM IR (-O2):
define void @disp_perct_bar(double %0) {
%2 = tail call i32 @putchar(i8 signext 91)
%3 = fcmp ogt double %0, 0.000000e+00
br i1 %3, label %8, label %6
4: ; preds = %8
%5 = icmp ult i32 %9, 95
br i1 %5, label %6, label %19
6: ; preds = %1, %4
%7 = phi i32 [ 0, %1 ], [ %11, %4 ]
br label %14
8: ; preds = %1, %8
%9 = phi i32 [ %11, %8 ], [ 0, %1 ]
%10 = tail call i32 @putchar(i8 signext 35)
%11 = add nuw nsw i32 %9, 5
%12 = sitofp i32 %11 to double
%13 = fcmp olt double %12, %0
br i1 %13, label %8, label %4
14: ; preds = %6, %14
%15 = phi i32 [ %17, %14 ], [ %7, %6 ]
%16 = tail call i32 @putchar(i8 signext 32)
%17 = add nuw nsw i32 %15, 5
%18 = icmp ult i32 %15, 95
br i1 %18, label %14, label %19
19: ; preds = %14, %4
%20 = tail call i32 @putchar(i8 signext 93)
ret void
}