#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 printProgress(double fx, int now, int total) {
  int i;
  double percent = (double)(100 * now) / total;
  int i_percent = (int)percent;
  for (i = 0; i < i_percent; i += 10) {
    printf("=");
  }
  printf("> %.2f%% %.20f\r", percent, fx);
}


x86 assembly (clang, -O0):
<printProgress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
imul   $0x64,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1170 <printProgress+0x60>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x14(%rbp)
jmp    1148 <printProgress+0x38>
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
lea    0xe81(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printProgress>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
imul   $0x64,%edi,%eax
cvtsi2sd %eax,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%ebx
test   %ebx,%ebx
jle    1161 <printProgress+0x41>
xor    %ebp,%ebp
xchg   %ax,%ax
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xa,%ebp
cmp    %ebx,%ebp
jl     1150 <printProgress+0x30>
lea    0xe98(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
@.str.1 = [16 x i8] c"> %.2f%% %.20f\0D\00"
define void @printProgress(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
%11 = mul nsw i32 100, %10
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %6
%14 = sitofp i32 %13 to double
%15 = fdiv double %12, %14
store double %15, double* %8
%16 = load double, double* %8
%17 = fptosi double %16 to i32
store i32 %17, i32* %9
store i32 0, i32* %7
br label %18
18: ; preds = %24, %3
%19 = load i32, i32* %7
%20 = load i32, i32* %9
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 10
store i32 %26, i32* %7
br label %18
27: ; preds = %18
%28 = load double, double* %8
%29 = load double, double* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %28, double %29)
ret void
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"> %.2f%% %.20f\0D\00"
define void @printProgress(double %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, 100
%5 = sitofp i32 %4 to double
%6 = sitofp i32 %2 to double
%7 = fdiv double %5, %6
%8 = fptosi double %7 to i32
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3, %10
%11 = phi i32 [ %13, %10 ], [ 0, %3 ]
%12 = tail call i32 @putchar(i32 61)
%13 = add nuw nsw i32 %11, 10
%14 = icmp slt i32 %13, %8
br i1 %14, label %10, label %15
15: ; preds = %10, %3
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %7, double %0)
ret void
}