#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 progressBar(unsigned short step, unsigned short monte_carlo_steps) {
  float ratio;
  unsigned short incomplete, x;
  ratio = (float)step / monte_carlo_steps;
  incomplete = ratio * 100;
  printf("%3d%% [", (int)(ratio * 100));
  for (x = 0; x < incomplete; x++)
    printf("=");
  for (x = incomplete; x < 100; x++)
    printf(" ");
  printf("]\r");
}


x86 assembly (clang, -O0):
<progressBar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
cvtsi2ss %eax,%xmm0
movzwl -0x4(%rbp),%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xeb4(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %ax,-0xa(%rbp)
movss  0xea0(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movw   $0x0,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
movzwl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    11ac <progressBar+0x9c>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    117d <progressBar+0x6d>
mov    -0xa(%rbp),%ax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
cmp    $0x64,%eax
jge    11e0 <progressBar+0xd0>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    11b4 <progressBar+0xa4>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progressBar>:
push   %rbp
push   %rbx
push   %rax
cvtsi2ss %edi,%xmm0
cvtsi2ss %esi,%xmm1
divss  %xmm1,%xmm0
mulss  0xec9(%rip),%xmm0
cvttss2si %xmm0,%ebx
lea    0xec2(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %bx,%bx
je     1176 <progressBar+0x56>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xffff,%bp
jne    1160 <progressBar+0x40>
cmp    $0x63,%bx
ja     118f <progressBar+0x6f>
add    $0xffffff9c,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %bx
jne    1180 <progressBar+0x60>
lea    0xe76(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%3d%% [\00"
@.str.1 = [2 x i8] c"=\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c"]\0D\00"
define void @progressBar(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca float
%6 = alloca i16
%7 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%8 = load i16, i16* %3
%9 = uitofp i16 %8 to float
%10 = load i16, i16* %4
%11 = zext i16 %10 to i32
%12 = sitofp i32 %11 to float
%13 = fdiv float %9, %12
store float %13, float* %5
%14 = load float, float* %5
%15 = fmul float %14, 1.000000e+02
%16 = fptoui float %15 to i16
store i16 %16, i16* %6
%17 = load float, float* %5
%18 = fmul float %17, 1.000000e+02
%19 = fptosi float %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %19)
store i16 0, i16* %7
br label %21
21: ; preds = %29, %2
%22 = load i16, i16* %7
%23 = zext i16 %22 to i32
%24 = load i16, i16* %6
%25 = zext i16 %24 to i32
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %32
27: ; preds = %21
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i16, i16* %7
%31 = add i16 %30, 1
store i16 %31, i16* %7
br label %21
32: ; preds = %21
%33 = load i16, i16* %6
store i16 %33, i16* %7
br label %34
34: ; preds = %40, %32
%35 = load i16, i16* %7
%36 = zext i16 %35 to i32
%37 = icmp slt i32 %36, 100
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %38
%41 = load i16, i16* %7
%42 = add i16 %41, 1
store i16 %42, i16* %7
br label %34
43: ; preds = %34
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%3d%% [\00"
@.str.3 = [3 x i8] c"]\0D\00"
define void @progressBar(i16 zeroext %0, i16 zeroext %1) {
%3 = uitofp i16 %0 to float
%4 = uitofp i16 %1 to float
%5 = fdiv float %3, %4
%6 = fmul float %5, 1.000000e+02
%7 = fptoui float %6 to i16
%8 = fptosi float %6 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = icmp eq i16 %7, 0
br i1 %10, label %13, label %14
11: ; preds = %14
%12 = icmp ult i16 %7, 100
br i1 %12, label %13, label %24
13: ; preds = %2, %11
br label %19
14: ; preds = %2, %14
%15 = phi i16 [ %17, %14 ], [ 0, %2 ]
%16 = tail call i32 @putchar(i32 61)
%17 = add nuw i16 %15, 1
%18 = icmp eq i16 %17, %7
br i1 %18, label %11, label %14
19: ; preds = %13, %19
%20 = phi i16 [ %22, %19 ], [ %7, %13 ]
%21 = tail call i32 @putchar(i32 32)
%22 = add i16 %20, 1
%23 = icmp eq i16 %22, 100
br i1 %23, label %24, label %19
24: ; preds = %19, %11
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}