#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void print_progress(unsigned long int processed_bytes, float percent_done) {
  time_t now;
  time(&now);
  fprintf(stderr, "[%.24s] hashgen: %6li MB processed", ctime(&now),
          processed_bytes / (1024 * 1024));
  if (percent_done >= 0)
    fprintf(stderr, " (%6.2f%%)", percent_done);
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<print_progress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
call   1050 <time@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <ctime@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
shr    $0x14,%rcx
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11ac <print_progress+0x7c>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7e(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_progress>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movss  %xmm0,(%rsp)
mov    %rdi,%rbx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <time@plt>
mov    0x2e8d(%rip),%r15
mov    (%r15),%ebp
mov    %r14,%rdi
call   1030 <ctime@plt>
shr    $0x14,%rbx
lea    0xe97(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
xorps  %xmm0,%xmm0
movss  (%rsp),%xmm1
ucomiss %xmm0,%xmm1
jb     119d <print_progress+0x6d>
mov    (%r15),%edi
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe8d(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    (%r15),%edi
lea    0xe87(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"[%.24s] hashgen: %6li MB processed\00"
@.str.1 = [11 x i8] c" (%6.2f%%)\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_progress(i64 %0, float %1) {
%3 = alloca i64
%4 = alloca float
%5 = alloca i32
store i64 %0, i64* %3
store float %1, float* %4
%6 = call i32 @time(i32* %5)
%7 = load i32, i32* @stderr
%8 = call i8* @ctime(i32* %5)
%9 = load i64, i64* %3
%10 = udiv i64 %9, 1048576
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %8, i64 %10)
%12 = load float, float* %4
%13 = fcmp oge float %12, 0.000000e+00
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load float, float* %4
%17 = fpext float %16 to double
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %17)
br label %19
19: ; preds = %14, %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"[%.24s] hashgen: %6li MB processed\00"
@.str.1 = [11 x i8] c" (%6.2f%%)\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_progress(i64 %0, float %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @time(i32* %3)
%6 = load i32, i32* @stderr
%7 = call i8* @ctime(i32* %3)
%8 = lshr i64 %0, 20
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %7, i64 %8)
%10 = fcmp ult float %1, 0.000000e+00
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = fpext float %1 to double
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %13)
br label %15
15: ; preds = %11, %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}