#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 print_time(const char *before, double t, const char *after) {
  char prefixes[] = "\0munpfazy";
  char *x = prefixes + 2;
  double ot = t;
  if (before)
    printf("%s", before);
  if (t > 100.0) {
    while (x[-1] && t > 100.0) {
      t /= 1000.0;
      --x;
    }
    if (t < 100.0) {
      printf("%.3f %cs", t, *x);
    } else {
      printf("%.3f s", t / 1000.0);
    }
  } else {
    while (x[1] && t < (100.0 / 1000.0)) {
      t *= 1000.0;
      ++x;
    }
    if (t > (100.0 / 1000.0))
      printf("%.3f %cs", t, *x);
    else
      printf("%g s", ot / 1000000.0);
  }
  if (after)
    printf("%s", after);
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0xef4(%rip),%rax
mov    %rax,-0x22(%rbp)
mov    0xef1(%rip),%ax
mov    %ax,-0x1a(%rbp)
lea    -0x22(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116e <print_time+0x5e>
mov    -0x8(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe85(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1244 <print_time+0x134>
jmp    118a <print_time+0x7a>
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x39(%rbp)
je     11b7 <print_time+0xa7>
movsd  -0x10(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    11c7 <print_time+0xb7>
jmp    11ee <print_time+0xde>
movsd  -0x10(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    118a <print_time+0x7a>
movsd  0xe0a(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1220 <print_time+0x110>
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsbl (%rax),%esi
lea    0xe19(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    123f <print_time+0x12f>
movsd  -0x10(%rbp),%xmm0
movsd  0xdeb(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdfe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12ff <print_time+0x1ef>
jmp    1249 <print_time+0x139>
mov    -0x30(%rbp),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x3a(%rbp)
je     1272 <print_time+0x162>
movsd  0xda1(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
seta   %al
mov    %al,-0x3a(%rbp)
mov    -0x3a(%rbp),%al
test   $0x1,%al
jne    1282 <print_time+0x172>
jmp    12a5 <print_time+0x195>
movsd  0xd8e(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1249 <print_time+0x139>
movsd  -0x10(%rbp),%xmm0
movsd  0xd56(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12db <print_time+0x1cb>
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsbl (%rax),%esi
lea    0xd5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12fa <print_time+0x1ea>
movsd  -0x38(%rbp),%xmm0
movsd  0xd28(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd4a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12ff <print_time+0x1ef>
cmpq   $0x0,-0x18(%rbp)
je     131c <print_time+0x20c>
mov    -0x18(%rbp),%rsi
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
movapd %xmm0,%xmm3
movabs $0x7a6166706e756d00,%rax
66 61 7a
mov    %rax,0x8(%rsp)
movw   $0x79,0x10(%rsp)
test   %rdi,%rdi
je     1154 <print_time+0x44>
mov    %rdi,%rsi
lea    0xee9(%rip),%rdi
xor    %eax,%eax
movsd  %xmm3,0x18(%rsp)
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm3
ucomisd 0xea4(%rip),%xmm3
jbe    11ae <print_time+0x9e>
lea    0xa(%rsp),%rax
movsd  0xea5(%rip),%xmm1
movsd  0xe8d(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
divsd  %xmm1,%xmm3
cmpb   $0x0,-0x2(%rax)
lea    -0x1(%rax),%rax
je     1194 <print_time+0x84>
ucomisd %xmm0,%xmm3
ja     1180 <print_time+0x70>
ucomisd %xmm3,%xmm0
jbe    121a <print_time+0x10a>
movsbl (%rax),%esi
lea    0xe85(%rip),%rdi
movapd %xmm3,%xmm0
jmp    11f8 <print_time+0xe8>
movsd  0xe52(%rip),%xmm1
lea    0xa(%rsp),%rax
ucomisd %xmm3,%xmm1
jbe    122b <print_time+0x11b>
movsd  0xe47(%rip),%xmm2
movapd %xmm3,%xmm0
nopl   (%rax)
mulsd  %xmm2,%xmm0
cmpb   $0x0,0x2(%rax)
lea    0x1(%rax),%rax
je     11e4 <print_time+0xd4>
ucomisd %xmm0,%xmm1
ja     11d0 <print_time+0xc0>
ucomisd 0xe1c(%rip),%xmm0
jbe    1239 <print_time+0x129>
movsbl (%rax),%esi
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
test   %rbx,%rbx
je     1258 <print_time+0x148>
lea    0xe1f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1030 <printf@plt>
divsd  0xdee(%rip),%xmm3
lea    0xe0d(%rip),%rdi
jmp    1248 <print_time+0x138>
movapd %xmm3,%xmm0
ucomisd 0xdd1(%rip),%xmm0
ja     11ee <print_time+0xde>
divsd  0xdd7(%rip),%xmm3
lea    0xdf5(%rip),%rdi
movapd %xmm3,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
test   %rbx,%rbx
jne    1204 <print_time+0xf4>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.print_time.prefixes = [10 x i8] c"\00munpfazy\00"
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"%.3f %cs\00"
@.str.2 = [7 x i8] c"%.3f s\00"
@.str.3 = [5 x i8] c"%g s\00"
define void @print_time(i8* %0, double %1, i8* %2) {
%4 = alloca i8*
%5 = alloca double
%6 = alloca i8*
%7 = alloca [10 x i8]
%8 = alloca i8*
%9 = alloca double
store i8* %0, i8** %4
store double %1, double* %5
store i8* %2, i8** %6
%10 = bitcast [10 x i8]* %7 to i8*
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds i8, i8* %11, i64 2
store i8* %12, i8** %8
%13 = load double, double* %5
store double %13, double* %9
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16, %3
%20 = load double, double* %5
%21 = fcmp ogt double %20, 1.000000e+02
br i1 %21, label %22, label %53
22: ; preds = %19
br label %23
23: ; preds = %34, %22
%24 = load i8*, i8** %8
%25 = getelementptr inbounds i8, i8* %24, i64 -1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = load double, double* %5
%31 = fcmp ogt double %30, 1.000000e+02
br label %32
32: ; preds = %29, %23
%33 = phi i1 [ false, %23 ], [ %31, %29 ]
br i1 %33, label %34, label %39
34: ; preds = %32
%35 = load double, double* %5
%36 = fdiv double %35, 1.000000e+03
store double %36, double* %5
%37 = load i8*, i8** %8
%38 = getelementptr inbounds i8, i8* %37, i32 -1
store i8* %38, i8** %8
br label %23
39: ; preds = %32
%40 = load double, double* %5
%41 = fcmp olt double %40, 1.000000e+02
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = load double, double* %5
%44 = load i8*, i8** %8
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %43, i32 %46)
br label %52
48: ; preds = %39
%49 = load double, double* %5
%50 = fdiv double %49, 1.000000e+03
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %50)
br label %52
52: ; preds = %48, %42
br label %84
53: ; preds = %19
br label %54
54: ; preds = %65, %53
%55 = load i8*, i8** %8
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = load double, double* %5
%62 = fcmp olt double %61, 1.000000e-01
br label %63
63: ; preds = %60, %54
%64 = phi i1 [ false, %54 ], [ %62, %60 ]
br i1 %64, label %65, label %70
65: ; preds = %63
%66 = load double, double* %5
%67 = fmul double %66, 1.000000e+03
store double %67, double* %5
%68 = load i8*, i8** %8
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %8
br label %54
70: ; preds = %63
%71 = load double, double* %5
%72 = fcmp ogt double %71, 1.000000e-01
br i1 %72, label %73, label %79
73: ; preds = %70
%74 = load double, double* %5
%75 = load i8*, i8** %8
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %74, i32 %77)
br label %83
79: ; preds = %70
%80 = load double, double* %9
%81 = fdiv double %80, 1.000000e+06
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %81)
br label %83
83: ; preds = %79, %73
br label %84
84: ; preds = %83, %52
%85 = load i8*, i8** %6
%86 = icmp ne i8* %85, null
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = load i8*, i8** %6
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %88)
br label %90
90: ; preds = %87, %84
ret void
}

LLVM IR (-O2):
@__const.print_time.prefixes = [10 x i8] c"\00munpfazy\00"
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"%.3f %cs\00"
@.str.2 = [7 x i8] c"%.3f s\00"
@.str.3 = [5 x i8] c"%g s\00"
define void @print_time(i8* %0, double %1, i8* %2) {
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 2
%7 = icmp eq i8* %0, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %8, %3
%11 = fcmp ogt double %1, 1.000000e+02
br i1 %11, label %16, label %12
12: ; preds = %10
%13 = fcmp olt double %1, 1.000000e-01
br i1 %13, label %14, label %45
14: ; preds = %12
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 3
br label %36
16: ; preds = %10
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 1
br label %18
18: ; preds = %16, %18
%19 = phi i8* [ %22, %18 ], [ %17, %16 ]
%20 = phi double [ %21, %18 ], [ %1, %16 ]
%21 = fdiv double %20, 1.000000e+03
%22 = getelementptr inbounds i8, i8* %19, i64 -1
%23 = load i8, i8* %22
%24 = icmp ne i8 %23, 0
%25 = fcmp ogt double %21, 1.000000e+02
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %18, label %27
27: ; preds = %18
%28 = fcmp olt double %21, 1.000000e+02
br i1 %28, label %29, label %33
29: ; preds = %27
%30 = load i8, i8* %19
%31 = sext i8 %30 to i32
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %21, i32 %31)
br label %56
33: ; preds = %27
%34 = fdiv double %21, 1.000000e+03
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %34)
br label %56
36: ; preds = %14, %36
%37 = phi i8* [ %40, %36 ], [ %15, %14 ]
%38 = phi double [ %39, %36 ], [ %1, %14 ]
%39 = fmul double %38, 1.000000e+03
%40 = getelementptr inbounds i8, i8* %37, i64 1
%41 = load i8, i8* %40
%42 = icmp ne i8 %41, 0
%43 = fcmp olt double %39, 1.000000e-01
%44 = select i1 %42, i1 %43, i1 false
br i1 %44, label %36, label %45
45: ; preds = %36, %12
%46 = phi i8* [ %6, %12 ], [ %37, %36 ]
%47 = phi double [ %1, %12 ], [ %39, %36 ]
%48 = fcmp ogt double %47, 1.000000e-01
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = load i8, i8* %46
%51 = sext i8 %50 to i32
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %47, i32 %51)
br label %56
53: ; preds = %45
%54 = fdiv double %1, 1.000000e+06
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %54)
br label %56
56: ; preds = %49, %53, %29, %33
%57 = icmp eq i8* %2, null
br i1 %57, label %60, label %58
58: ; preds = %56
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %60
60: ; preds = %58, %56
ret void
}