#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*/ move(int, int);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
void progressbar(double percent, int line) {
  int i;
  for (i = 0; i < (int)(percent * 25.); i++) {
    move(line, 25 + i);
    printw("#");
  }
  refresh();
}


x86 assembly (clang, -O0):
<progressbar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movsd  0xeae(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%ecx
cmp    %ecx,%eax
jge    118b <progressbar+0x5b>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    $0x19,%esi
call   1050 <move@plt>
lea    0xe90(%rip),%rdi
call   1030 <printw@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <progressbar+0x17>
mov    $0x0,%al
call   1040 <refresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progressbar>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mulsd  0xec1(%rip),%xmm0
cvttsd2si %xmm0,%ebp
test   %ebp,%ebp
jle    1184 <progressbar+0x54>
mov    %edi,%r15d
neg    %ebp
mov    $0x19,%ebx
lea    0xeb0(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %ebx,%esi
call   1050 <move@plt>
mov    %r14,%rdi
call   1030 <printw@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x19,%eax
jne    1160 <progressbar+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <refresh@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"#\00"
define void @progressbar(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load double, double* %3
%9 = fmul double %8, 2.500000e+01
%10 = fptosi double %9 to i32
%11 = icmp slt i32 %7, %10
br i1 %11, label %12, label %21
12: ; preds = %6
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = add nsw i32 25, %14
%16 = call i32 @move(i32 %13, i32 %15)
%17 = call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %12
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"#\00"
define void @progressbar(double %0, i32 %1) {
%3 = fmul double %0, 2.500000e+01
%4 = fptosi double %3 to i32
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %2, %6
%7 = phi i32 [ %11, %6 ], [ 0, %2 ]
%8 = add nuw nsw i32 %7, 25
%9 = tail call i32 @move(i32 %1, i32 %8)
%10 = tail call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = add nuw nsw i32 %7, 1
%12 = icmp eq i32 %11, %4
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 (...) @refresh()
ret void
}