#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*/ fprintf(int /*<<< orphan*/, char *, unsigned int, ...);
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int, char *, int);
int main() {
  char buffer[192];
  unsigned int count = 0;
  while (read(0, buffer, 192) == 192) {
    write(1, buffer + 4, 188);
    if (!(count & 0xFFF))
      fprintf(stderr, "\r%.0f MB", count * 188.0f / 1024.0f / 1024.0f);
    ++count;
  }
  fprintf(stderr, "\r%.1f MB, %u packets\n", count * 188.0f / 1024.0f / 1024.0f,
          count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd4(%rbp)
lea    -0xd0(%rbp),%rsi
xor    %edi,%edi
mov    $0xc0,%edx
call   1040 <read@plt>
cmp    $0xc0,%eax
jne    11f1 <main+0xc1>
lea    -0xd0(%rbp),%rsi
add    $0x4,%rsi
mov    $0x1,%edi
mov    $0xbc,%edx
call   1030 <write@plt>
mov    -0xd4(%rbp),%eax
and    $0xfff,%eax
cmp    $0x0,%eax
jne    11dd <main+0xad>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%eax
cvtsi2ss %rax,%xmm0
movss  0xe4c(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe44(%rip),%xmm1
divss  %xmm1,%xmm0
divss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
mov    %eax,%edx
lea    0xe32(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    114c <main+0x1c>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
mov    -0xd4(%rbp),%eax
cvtsi2ss %rax,%xmm0
movss  0xdf3(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdeb(%rip),%xmm1
divss  %xmm1,%xmm0
divss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
mov    %eax,%edx
mov    -0xd4(%rbp),%ecx
lea    0xddc(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc0,%rsp
xor    %ebx,%ebx
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0xc0,%edx
call   1040 <read@plt>
cmp    $0xc0,%eax
jne    11ea <main+0xba>
lea    0x4(%rsp),%r14
mov    0x2e78(%rip),%r13
lea    0xe99(%rip),%r15
mov    %rsp,%r12
xor    %ebx,%ebx
jmp    1199 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebx
xor    %edi,%edi
mov    %r12,%rsi
mov    $0xc0,%edx
call   1040 <read@plt>
cmp    $0xc0,%eax
jne    11ea <main+0xba>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0xbc,%edx
call   1030 <write@plt>
test   $0xfff,%ebx
jne    1180 <main+0x50>
mov    0x0(%r13),%edi
mov    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0xe37(%rip),%xmm0
movss  0xe33(%rip),%xmm1
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%rdx
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1180 <main+0x50>
mov    0x2def(%rip),%rax
mov    %ebx,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %rcx,%xmm0
mov    (%rax),%edi
mulss  0xdfb(%rip),%xmm0
movss  0xdf7(%rip),%xmm1
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%rdx
lea    0xdf0(%rip),%rsi
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"\0D%.0f MB\00"
@.str.1 = [22 x i8] c"\0D%.1f MB, %u packets\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [192 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %24, %0
%5 = getelementptr inbounds [192 x i8], [192 x i8]* %2, i64 0, i64 0
%6 = call i32 @read(i32 0, i8* %5, i32 192)
%7 = icmp eq i32 %6, 192
br i1 %7, label %8, label %27
8: ; preds = %4
%9 = getelementptr inbounds [192 x i8], [192 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds i8, i8* %9, i64 4
%11 = call i32 @write(i32 1, i8* %10, i32 188)
%12 = load i32, i32* %3
%13 = and i32 %12, 4095
%14 = icmp ne i32 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %8
%16 = load i32, i32* @stderr
%17 = load i32, i32* %3
%18 = uitofp i32 %17 to float
%19 = fmul float %18, 1.880000e+02
%20 = fdiv float %19, 1.024000e+03
%21 = fdiv float %20, 1.024000e+03
%22 = fptoui float %21 to i32
%23 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %15, %8
%25 = load i32, i32* %3
%26 = add i32 %25, 1
store i32 %26, i32* %3
br label %4
27: ; preds = %4
%28 = load i32, i32* @stderr
%29 = load i32, i32* %3
%30 = uitofp i32 %29 to float
%31 = fmul float %30, 1.880000e+02
%32 = fdiv float %31, 1.024000e+03
%33 = fdiv float %32, 1.024000e+03
%34 = fptoui float %33 to i32
%35 = load i32, i32* %3
%36 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %35)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"\0D%.0f MB\00"
@.str.1 = [22 x i8] c"\0D%.1f MB, %u packets\0A\00"
define i32 @main() {
%1 = alloca [192 x i8]
%2 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 192)
%4 = icmp eq i32 %3, 192
br i1 %4, label %5, label %24
5: ; preds = %0
%6 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 4
br label %7
7: ; preds = %5, %20
%8 = phi i32 [ 0, %5 ], [ %21, %20 ]
%9 = call i32 @write(i32 1, i8* %6, i32 188)
%10 = and i32 %8, 4095
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = uitofp i32 %8 to float
%15 = fmul float %14, 1.880000e+02
%16 = fmul float %15, 0x3F50000000000000
%17 = fmul float %16, 0x3F50000000000000
%18 = fptoui float %17 to i32
%19 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %12, %7
%21 = add i32 %8, 1
%22 = call i32 @read(i32 0, i8* %2, i32 192)
%23 = icmp eq i32 %22, 192
br i1 %23, label %7, label %24
24: ; preds = %20, %0
%25 = phi i32 [ 0, %0 ], [ %21, %20 ]
%26 = load i32, i32* @stderr
%27 = uitofp i32 %25 to float
%28 = fmul float %27, 1.880000e+02
%29 = fmul float %28, 0x3F50000000000000
%30 = fmul float %29, 0x3F50000000000000
%31 = fptoui float %30 to i32
%32 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %25)
ret i32 0
}