#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 *);
int /*<<< orphan*/ putchar(int);
int custom_pb_fct(float rate) {
  if (!rate)
    printf("Rate = 0\n");
  const int barsize = 100;
  putchar(0xD);
  float i;
  for (i = 0; i < barsize * rate; i++) {
    putchar('*');
  }
  for (; i < barsize; i++)
    putchar('-');
  putchar(0xD);
  if (rate == 1.0)
    printf("\n fin!\n");
  return 1;
}


x86 assembly (clang, -O0):
<custom_pb_fct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1150 <custom_pb_fct+0x30>
jp     1150 <custom_pb_fct+0x30>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
movl   $0x64,-0x8(%rbp)
mov    $0xd,%edi
call   1030 <putchar@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm1
movss  0xe8a(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11a5 <custom_pb_fct+0x85>
mov    $0x2a,%edi
call   1030 <putchar@plt>
movss  0xe6e(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1169 <custom_pb_fct+0x49>
jmp    11aa <custom_pb_fct+0x8a>
movss  0xe4e(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11dd <custom_pb_fct+0xbd>
mov    $0x2d,%edi
call   1030 <putchar@plt>
movss  0xe36(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11aa <custom_pb_fct+0x8a>
mov    $0xd,%edi
call   1030 <putchar@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe10(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1214 <custom_pb_fct+0xf4>
jp     1214 <custom_pb_fct+0xf4>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<custom_pb_fct>:
sub    $0x18,%rsp
xorps  %xmm1,%xmm1
movss  %xmm0,0x10(%rsp)
ucomiss %xmm1,%xmm0
jne    1140 <custom_pb_fct+0x20>
jp     1140 <custom_pb_fct+0x20>
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
mov    $0xd,%edi
call   1030 <putchar@plt>
movss  0xeae(%rip),%xmm0
mulss  0x10(%rsp),%xmm0
ucomiss 0xea9(%rip),%xmm0
xorps  %xmm1,%xmm1
jbe    119b <custom_pb_fct+0x7b>
xorps  %xmm1,%xmm1
movss  %xmm0,0x14(%rsp)
nopl   (%rax)
movss  %xmm1,0xc(%rsp)
mov    $0x2a,%edi
call   1030 <putchar@plt>
movss  0x14(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
addss  0xe70(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1170 <custom_pb_fct+0x50>
jmp    11b9 <custom_pb_fct+0x99>
movss  %xmm1,0xc(%rsp)
mov    $0x2d,%edi
call   1030 <putchar@plt>
movss  0xc(%rsp),%xmm1
addss  0xe4b(%rip),%xmm1
movss  0xe3f(%rip),%xmm0
ucomiss %xmm1,%xmm0
ja     119b <custom_pb_fct+0x7b>
mov    $0xd,%edi
call   1030 <putchar@plt>
movss  0x10(%rsp),%xmm0
ucomiss 0xe27(%rip),%xmm0
jne    11ed <custom_pb_fct+0xcd>
jp     11ed <custom_pb_fct+0xcd>
lea    0xe2d(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Rate = 0\0A\00"
@.str.1 = [8 x i8] c"\0A fin!\0A\00"
define i32 @custom_pb_fct(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = fcmp une float %5, 0.000000e+00
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
store i32 100, i32* %3
%10 = call i32 @putchar(i32 13)
store float 0.000000e+00, float* %4
br label %11
11: ; preds = %18, %9
%12 = load float, float* %4
%13 = load float, float* %2
%14 = fmul float 1.000000e+02, %13
%15 = fcmp olt float %12, %14
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = call i32 @putchar(i32 42)
br label %18
18: ; preds = %16
%19 = load float, float* %4
%20 = fadd float %19, 1.000000e+00
store float %20, float* %4
br label %11
21: ; preds = %11
br label %22
22: ; preds = %27, %21
%23 = load float, float* %4
%24 = fcmp olt float %23, 1.000000e+02
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = call i32 @putchar(i32 45)
br label %27
27: ; preds = %25
%28 = load float, float* %4
%29 = fadd float %28, 1.000000e+00
store float %29, float* %4
br label %22
30: ; preds = %22
%31 = call i32 @putchar(i32 13)
%32 = load float, float* %2
%33 = fpext float %32 to double
%34 = fcmp oeq double %33, 1.000000e+00
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %37
37: ; preds = %35, %30
ret i32 1
}

LLVM IR (-O2):
@str = [9 x i8] c"Rate = 0\00"
@str.2 = [7 x i8] c"\0A fin!\00"
define i32 @custom_pb_fct(float %0) {
%2 = fcmp une float %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @putchar(i32 13)
%7 = fmul float %0, 1.000000e+02
%8 = fcmp ogt float %7, 0.000000e+00
br i1 %8, label %13, label %11
9: ; preds = %13
%10 = fcmp olt float %16, 1.000000e+02
br i1 %10, label %11, label %23
11: ; preds = %5, %9
%12 = phi float [ 0.000000e+00, %5 ], [ %16, %9 ]
br label %18
13: ; preds = %5, %13
%14 = phi float [ %16, %13 ], [ 0.000000e+00, %5 ]
%15 = tail call i32 @putchar(i32 42)
%16 = fadd float %14, 1.000000e+00
%17 = fcmp olt float %16, %7
br i1 %17, label %13, label %9
18: ; preds = %11, %18
%19 = phi float [ %21, %18 ], [ %12, %11 ]
%20 = tail call i32 @putchar(i32 45)
%21 = fadd float %19, 1.000000e+00
%22 = fcmp olt float %21, 1.000000e+02
br i1 %22, label %18, label %23
23: ; preds = %18, %9
%24 = tail call i32 @putchar(i32 13)
%25 = fcmp oeq float %0, 1.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
ret i32 1
}