#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 progress(int global, int curent) {
  int i;
  float j;
  float d = 50;
  float proc;
  float g = (float)global;
  float c = (float)curent;
  proc = c / g;
  j = proc * d;
  printf("\r[");
  for (i = 0; i <= d; ++i) {
    if (i <= j)
      printf("#");
    else
      printf(" ");
  }
  printf("]\t%.2f%%", proc * 100);
  if (proc == 1) {
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<progress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
divss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11cc <progress+0xbc>
cvtsi2ssl -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11ab <progress+0x9b>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b9 <progress+0xa9>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11be <progress+0xae>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <progress+0x62>
movss  0xe34(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
movss  0xe0c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1215 <progress+0x105>
jp     1215 <progress+0x105>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progress>:
push   %rbx
sub    $0x10,%rsp
cvtsi2ss %edi,%xmm0
cvtsi2ss %esi,%xmm1
divss  %xmm0,%xmm1
movss  0xec7(%rip),%xmm0
movss  %xmm1,0x8(%rsp)
mulss  %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xebc(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
xor    %eax,%eax
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
setae  %al
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x33,%ebx
jne    1160 <progress+0x40>
movss  0xe74(%rip),%xmm0
mulss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
ucomiss 0xe53(%rip),%xmm0
jne    11c8 <progress+0xa8>
jp     11c8 <progress+0xa8>
mov    $0xa,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D[\00"
@.str.1 = [2 x i8] c"#\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [9 x i8] c"]\09%.2f%%\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @progress(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
store float 5.000000e+01, float* %7
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
store float %12, float* %9
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to float
store float %14, float* %10
%15 = load float, float* %10
%16 = load float, float* %9
%17 = fdiv float %15, %16
store float %17, float* %8
%18 = load float, float* %8
%19 = load float, float* %7
%20 = fmul float %18, %19
store float %20, float* %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %22
22: ; preds = %37, %2
%23 = load i32, i32* %5
%24 = sitofp i32 %23 to float
%25 = load float, float* %7
%26 = fcmp ole float %24, %25
br i1 %26, label %27, label %40
27: ; preds = %22
%28 = load i32, i32* %5
%29 = sitofp i32 %28 to float
%30 = load float, float* %6
%31 = fcmp ole float %29, %30
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %36
34: ; preds = %27
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %22
40: ; preds = %22
%41 = load float, float* %8
%42 = fmul float %41, 1.000000e+02
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %43)
%45 = load float, float* %8
%46 = fcmp oeq float %45, 1.000000e+00
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %40
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D[\00"
@.str.3 = [9 x i8] c"]\09%.2f%%\00"
define void @progress(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = sitofp i32 %1 to float
%5 = fdiv float %4, %3
%6 = fmul float %5, 5.000000e+01
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %8
%9 = phi i32 [ 0, %2 ], [ %14, %8 ]
%10 = sitofp i32 %9 to float
%11 = fcmp ult float %6, %10
%12 = select i1 %11, i32 32, i32 35
%13 = tail call i32 @putchar(i32 %12)
%14 = add nuw nsw i32 %9, 1
%15 = icmp eq i32 %14, 51
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = fmul float %5, 1.000000e+02
%18 = fpext float %17 to double
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %18)
%20 = fcmp oeq float %5, 1.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = tail call i32 @putchar(i32 10)
br label %23
23: ; preds = %21, %16
ret void
}