#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
long time(int /*<<< orphan*/ *);
void mprint(long rlen) {
  static long startt, prevt;
  long currt;
  static long totlen = 0;
  long t1, t2;
  int i;
  currt = time(NULL);
  if (!totlen) {
    totlen = rlen;
    startt = currt;
    fprintf(stderr, "               ");
    for (i = 0; i < 10; i++)
      fprintf(stderr, "------");
  }
  if (currt != prevt || !rlen) {
    t1 = currt - startt;
    if (rlen != totlen)
      t2 = (currt - startt) * (float)totlen / (totlen - rlen);
    else
      t2 = 0;
    if (t2 > 9999) {
      t1 /= 60;
      t2 /= 60;
      i = 0;
    } else
      i = 1;
    fprintf(stderr, "\r%4u/%4u %4s ", (int)t1, (int)t2, i ? "sec." : "min.");
    if (totlen) {
      i = (int)(60 * (float)(totlen - rlen) / totlen);
      while (i--)
        fprintf(stderr, ".");
    }
    fflush(stderr);
    prevt = currt;
  }
  if (!rlen)
    totlen = 0;
}


x86 assembly (clang, -O0):
<mprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,0x2eff(%rip)
jne    11bf <mprint+0x8f>
mov    -0x8(%rbp),%rax
mov    %rax,0x2eee(%rip)
mov    -0x10(%rbp),%rax
mov    %rax,0x2ed3(%rip)
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
jge    11ba <mprint+0x8a>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118b <mprint+0x5b>
jmp    11bf <mprint+0x8f>
mov    -0x10(%rbp),%rax
cmp    0x2e7e(%rip),%rax
jne    11db <mprint+0xab>
cmpq   $0x0,-0x8(%rbp)
jne    134e <mprint+0x21e>
mov    -0x10(%rbp),%rax
sub    0x2e5a(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    0x2e5b(%rip),%rax
je     123a <mprint+0x10a>
mov    -0x10(%rbp),%rax
sub    0x2e3a(%rip),%rax
cvtsi2ss %rax,%xmm0
cvtsi2ssq 0x2e3c(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    0x2e31(%rip),%rax
sub    -0x8(%rbp),%rax
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
mov    %rax,-0x20(%rbp)
jmp    1242 <mprint+0x112>
movq   $0x0,-0x20(%rbp)
cmpq   $0x270f,-0x20(%rbp)
jle    1280 <mprint+0x150>
mov    -0x18(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
jmp    1287 <mprint+0x157>
movl   $0x1,-0x24(%rbp)
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x24(%rbp),%esi
lea    0xd88(%rip),%r8
lea    0xd7c(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%r8
lea    0xd60(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,0x2d86(%rip)
je     1335 <mprint+0x205>
mov    0x2d79(%rip),%rax
sub    -0x8(%rbp),%rax
cvtsi2ss %rax,%xmm1
movss  0xd18(%rip),%xmm0
mulss  %xmm1,%xmm0
cvtsi2ssq 0x2d5b(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x24(%rbp)
cmp    $0x0,%eax
je     1330 <mprint+0x200>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
lea    0xd08(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1300 <mprint+0x1d0>
jmp    1335 <mprint+0x205>
mov    0x2ca4(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x10(%rbp),%rax
mov    %rax,0x2cfa(%rip)
cmpq   $0x0,-0x8(%rbp)
jne    1364 <mprint+0x234>
movq   $0x0,0x2cec(%rip)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mprint>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r15
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,%r14
cmpq   $0x0,0x2f03(%rip)
je     115d <mprint+0x2d>
test   %r15,%r15
jne    121c <mprint+0xec>
jmp    1237 <mprint+0x107>
mov    %r15,0x2eec(%rip)
mov    %r14,0x2ed5(%rip)
mov    0x2e6e(%rip),%r12
mov    (%r12),%edi
lea    0xe87(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
lea    0xe85(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r15,%r15
je     1237 <mprint+0x107>
cmp    0x2e25(%rip),%r14
jne    1237 <mprint+0x107>
test   %r15,%r15
je     134c <mprint+0x21c>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rbx
sub    0x2dff(%rip),%rbx
mov    0x2e08(%rip),%rcx
lea    0xdda(%rip),%r8
mov    %rcx,%rax
sub    %r15,%rax
jne    125b <mprint+0x12b>
xor    %ecx,%ecx
jmp    12be <mprint+0x18e>
cvtsi2ss %rbx,%xmm0
cvtsi2ss %rcx,%xmm1
mulss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
divss  %xmm0,%xmm1
cvttss2si %xmm1,%rcx
cmp    $0x2710,%rcx
jl     12be <mprint+0x18e>
movabs $0x8888888888888889,%rdi
88 88 88
mov    %rbx,%rax
imul   %rdi
mov    %rdx,%rsi
add    %rbx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x5,%rsi
add    %rax,%rsi
mov    %rcx,%rax
mul    %rdi
mov    %rdx,%rcx
shr    $0x5,%rcx
lea    0xd73(%rip),%r8
mov    %rsi,%rbx
mov    0x2d1b(%rip),%r12
mov    (%r12),%edi
lea    0xd4b(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2d70(%rip),%rax
test   %rax,%rax
je     1333 <mprint+0x203>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
sub    %r15,%rax
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
mulss  0xd00(%rip),%xmm1
divss  %xmm0,%xmm1
cvttss2si %xmm1,%ebp
test   %ebp,%ebp
je     1333 <mprint+0x203>
lea    0xd19(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0xffffffff,%ebp
jne    1320 <mprint+0x1f0>
mov    (%r12),%edi
call   1050 <fflush@plt>
mov    %r14,0x2d05(%rip)
test   %r15,%r15
jne    122e <mprint+0xfe>
movq   $0x0,0x2cf9(%rip)
jmp    122e <mprint+0xfe>

LLVM IR (-O0):
@mprint.startt = internal global i64 0
@mprint.prevt = internal global i64 0
@mprint.totlen = internal global i64 0
@stderr = global i32 0
@.str = [16 x i8] c" \00"
@.str.1 = [7 x i8] c"------\00"
@.str.2 = [14 x i8] c"\0D%4u/%4u %4s \00"
@.str.3 = [5 x i8] c"sec.\00"
@.str.4 = [5 x i8] c"min.\00"
@.str.5 = [2 x i8] c".\00"
define void @mprint(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i64 %0, i64* %2
%7 = call i64 @time(i32* null)
store i64 %7, i64* %3
%8 = load i64, i64* @mprint.totlen
%9 = icmp ne i64 %8, 0
br i1 %9, label %25, label %10
10: ; preds = %1
%11 = load i64, i64* %2
store i64 %11, i64* @mprint.totlen
%12 = load i64, i64* %3
store i64 %12, i64* @mprint.startt
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %15
15: ; preds = %21, %10
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %15
24: ; preds = %15
br label %25
25: ; preds = %24, %1
%26 = load i64, i64* %3
%27 = load i64, i64* @mprint.prevt
%28 = icmp ne i64 %26, %27
br i1 %28, label %32, label %29
29: ; preds = %25
%30 = load i64, i64* %2
%31 = icmp ne i64 %30, 0
br i1 %31, label %98, label %32
32: ; preds = %29, %25
%33 = load i64, i64* %3
%34 = load i64, i64* @mprint.startt
%35 = sub nsw i64 %33, %34
store i64 %35, i64* %4
%36 = load i64, i64* %2
%37 = load i64, i64* @mprint.totlen
%38 = icmp ne i64 %36, %37
br i1 %38, label %39, label %53
39: ; preds = %32
%40 = load i64, i64* %3
%41 = load i64, i64* @mprint.startt
%42 = sub nsw i64 %40, %41
%43 = sitofp i64 %42 to float
%44 = load i64, i64* @mprint.totlen
%45 = sitofp i64 %44 to float
%46 = fmul float %43, %45
%47 = load i64, i64* @mprint.totlen
%48 = load i64, i64* %2
%49 = sub nsw i64 %47, %48
%50 = sitofp i64 %49 to float
%51 = fdiv float %46, %50
%52 = fptosi float %51 to i64
store i64 %52, i64* %5
br label %54
53: ; preds = %32
store i64 0, i64* %5
br label %54
54: ; preds = %53, %39
%55 = load i64, i64* %5
%56 = icmp sgt i64 %55, 9999
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i64, i64* %4
%59 = sdiv i64 %58, 60
store i64 %59, i64* %4
%60 = load i64, i64* %5
%61 = sdiv i64 %60, 60
store i64 %61, i64* %5
store i32 0, i32* %6
br label %63
62: ; preds = %54
store i32 1, i32* %6
br label %63
63: ; preds = %62, %57
%64 = load i32, i32* @stderr
%65 = load i64, i64* %4
%66 = trunc i64 %65 to i32
%67 = load i64, i64* %5
%68 = trunc i64 %67 to i32
%69 = load i32, i32* %6
%70 = icmp ne i32 %69, 0
%71 = zext i1 %70 to i64
%72 = select i1 %70, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %66, i32 %68, i8* %72)
%74 = load i64, i64* @mprint.totlen
%75 = icmp ne i64 %74, 0
br i1 %75, label %76, label %94
76: ; preds = %63
%77 = load i64, i64* @mprint.totlen
%78 = load i64, i64* %2
%79 = sub nsw i64 %77, %78
%80 = sitofp i64 %79 to float
%81 = fmul float 6.000000e+01, %80
%82 = load i64, i64* @mprint.totlen
%83 = sitofp i64 %82 to float
%84 = fdiv float %81, %83
%85 = fptosi float %84 to i32
store i32 %85, i32* %6
br label %86
86: ; preds = %90, %76
%87 = load i32, i32* %6
%88 = add nsw i32 %87, -1
store i32 %88, i32* %6
%89 = icmp ne i32 %87, 0
br i1 %89, label %90, label %93
90: ; preds = %86
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %86
93: ; preds = %86
br label %94
94: ; preds = %93, %63
%95 = load i32, i32* @stderr
%96 = call i32 @fflush(i32 %95)
%97 = load i64, i64* %3
store i64 %97, i64* @mprint.prevt
br label %98
98: ; preds = %94, %29
%99 = load i64, i64* %2
%100 = icmp ne i64 %99, 0
br i1 %100, label %102, label %101
101: ; preds = %98
store i64 0, i64* @mprint.totlen
br label %102
102: ; preds = %101, %98
ret void
}

LLVM IR (-O2):
@mprint.startt = internal unnamed_addr global i64 0
@mprint.prevt = internal unnamed_addr global i64 0
@mprint.totlen = internal unnamed_addr global i64 0
@stderr = global i32 0
@.str = [16 x i8] c" \00"
@.str.1 = [7 x i8] c"------\00"
@.str.2 = [14 x i8] c"\0D%4u/%4u %4s \00"
@.str.3 = [5 x i8] c"sec.\00"
@.str.4 = [5 x i8] c"min.\00"
@.str.5 = [2 x i8] c".\00"
define void @mprint(i64 %0) {
%2 = tail call i64 @time(i32* null)
%3 = load i64, i64* @mprint.totlen
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %28
5: ; preds = %1
store i64 %0, i64* @mprint.totlen
store i64 %2, i64* @mprint.startt
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %5, %1
%29 = load i64, i64* @mprint.prevt
%30 = icmp eq i64 %2, %29
%31 = icmp ne i64 %0, 0
%32 = and i1 %31, %30
br i1 %32, label %77, label %33
33: ; preds = %28
%34 = load i64, i64* @mprint.startt
%35 = sub nsw i64 %2, %34
%36 = load i64, i64* @mprint.totlen
%37 = icmp eq i64 %36, %0
br i1 %37, label %50, label %38
38: ; preds = %33
%39 = sitofp i64 %35 to float
%40 = sitofp i64 %36 to float
%41 = fmul float %39, %40
%42 = sub nsw i64 %36, %0
%43 = sitofp i64 %42 to float
%44 = fdiv float %41, %43
%45 = fptosi float %44 to i64
%46 = icmp sgt i64 %45, 9999
br i1 %46, label %47, label %50
47: ; preds = %38
%48 = sdiv i64 %35, 60
%49 = udiv i64 %45, 60
br label %50
50: ; preds = %33, %38, %47
%51 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %47 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %38 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %33 ]
%52 = phi i64 [ %48, %47 ], [ %35, %38 ], [ %35, %33 ]
%53 = phi i64 [ %49, %47 ], [ %45, %38 ], [ 0, %33 ]
%54 = load i32, i32* @stderr
%55 = trunc i64 %52 to i32
%56 = trunc i64 %53 to i32
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %55, i32 %56, i8* %51)
%58 = load i64, i64* @mprint.totlen
%59 = icmp eq i64 %58, 0
br i1 %59, label %74, label %60
60: ; preds = %50
%61 = sub nsw i64 %58, %0
%62 = sitofp i64 %61 to float
%63 = fmul float %62, 6.000000e+01
%64 = sitofp i64 %58 to float
%65 = fdiv float %63, %64
%66 = fptosi float %65 to i32
%67 = icmp eq i32 %66, 0
br i1 %67, label %74, label %68
68: ; preds = %60, %68
%69 = phi i32 [ %70, %68 ], [ %66, %60 ]
%70 = add nsw i32 %69, -1
%71 = load i32, i32* @stderr
%72 = tail call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%73 = icmp eq i32 %70, 0
br i1 %73, label %74, label %68
74: ; preds = %68, %60, %50
%75 = load i32, i32* @stderr
%76 = tail call i32 @fflush(i32 %75)
store i64 %2, i64* @mprint.prevt
br label %77
77: ; preds = %28, %74
br i1 %31, label %79, label %78
78: ; preds = %77
store i64 0, i64* @mprint.totlen
br label %79
79: ; preds = %78, %77
ret void
}