#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 u_char;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, ...);
void print_ext_speed(u_char x, int scale) {
  static const char *mant[] = {"Reserved", "1.0", "1.2", "1.3", "1.5", "2.0",
                               "2.5",      "3.0", "3.5", "4.0", "4.5", "5.0",
                               "5.5",      "6.0", "7.0", "8.0"};
  static const char *exp[] = {"1 ns",  "10 ns",  "100 ns", "1 us",
                              "10 us", "100 us", "1 ms",   "10 ms"};
  static const char *scale_name[] = {"None",      "10",        "100",
                                     "1,000",     "10,000",    "100,000",
                                     "1,000,000", "10,000,000"};
  printf("Speed = %s x %s", mant[(x >> 3) & 0xF], exp[x & 7]);
  if (scale)
    printf(", scaled by %s", scale_name[scale & 7]);
}


x86 assembly (clang, -O0):
<print_ext_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0x2eff(%rip),%rax
mov    (%rax,%rcx,8),%rsi
mov    -0x4(%rbp),%eax
and    $0x7,%eax
movslq %eax,%rcx
lea    0x2f6b(%rip),%rax
mov    (%rax,%rcx,8),%rdx
lea    0xf5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1183 <print_ext_speed+0x73>
mov    -0x8(%rbp),%eax
and    $0x7,%eax
movslq %eax,%rcx
lea    0x2f7f(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xf3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ext_speed>:
push   %rbx
mov    %esi,%ebx
mov    %edi,%eax
shr    $0x3,%eax
and    $0xf,%eax
lea    0xede(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
and    $0x7,%edi
lea    0xf0d(%rip),%rax
movslq (%rax,%rdi,4),%rdx
add    %rax,%rdx
lea    0xfe9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     116c <print_ext_speed+0x5c>
and    $0x7,%ebx
lea    0xf0a(%rip),%rax
movslq (%rax,%rbx,4),%rsi
add    %rax,%rsi
lea    0xfd6(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@print_ext_speed.mant = internal global [16 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0)]
@.str = [9 x i8] c"Reserved\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [4 x i8] c"1.2\00"
@.str.3 = [4 x i8] c"1.3\00"
@.str.4 = [4 x i8] c"1.5\00"
@.str.5 = [4 x i8] c"2.0\00"
@.str.6 = [4 x i8] c"2.5\00"
@.str.7 = [4 x i8] c"3.0\00"
@.str.8 = [4 x i8] c"3.5\00"
@.str.9 = [4 x i8] c"4.0\00"
@.str.10 = [4 x i8] c"4.5\00"
@.str.11 = [4 x i8] c"5.0\00"
@.str.12 = [4 x i8] c"5.5\00"
@.str.13 = [4 x i8] c"6.0\00"
@.str.14 = [4 x i8] c"7.0\00"
@.str.15 = [4 x i8] c"8.0\00"
@print_ext_speed.exp = internal global [8 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i32 0, i32 0)]
@.str.16 = [5 x i8] c"1 ns\00"
@.str.17 = [6 x i8] c"10 ns\00"
@.str.18 = [7 x i8] c"100 ns\00"
@.str.19 = [5 x i8] c"1 us\00"
@.str.20 = [6 x i8] c"10 us\00"
@.str.21 = [7 x i8] c"100 us\00"
@.str.22 = [5 x i8] c"1 ms\00"
@.str.23 = [6 x i8] c"10 ms\00"
@print_ext_speed.scale_name = internal global [8 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.31, i32 0, i32 0)]
@.str.24 = [5 x i8] c"None\00"
@.str.25 = [3 x i8] c"10\00"
@.str.26 = [4 x i8] c"100\00"
@.str.27 = [6 x i8] c"1,000\00"
@.str.28 = [7 x i8] c"10,000\00"
@.str.29 = [8 x i8] c"100,000\00"
@.str.30 = [10 x i8] c"1,000,000\00"
@.str.31 = [11 x i8] c"10,000,000\00"
@.str.32 = [16 x i8] c"Speed = %s x %s\00"
@.str.33 = [15 x i8] c", scaled by %s\00"
define void @print_ext_speed(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = ashr i32 %5, 3
%7 = and i32 %6, 15
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [16 x i8*], [16 x i8*]* @print_ext_speed.mant, i64 0, i64 %8
%10 = load i8*, i8** %9
%11 = load i32, i32* %3
%12 = and i32 %11, 7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [8 x i8*], [8 x i8*]* @print_ext_speed.exp, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* %10, i8* %15)
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %2
%20 = load i32, i32* %4
%21 = and i32 %20, 7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x i8*], [8 x i8*]* @print_ext_speed.scale_name, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.33, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %19, %2
ret void
}

LLVM IR (-O2):
@reltable.print_ext_speed = internal unnamed_addr constant [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.12 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.13 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.14 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.15 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_ext_speed to i64)) to i32)]
@.str = [9 x i8] c"Reserved\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [4 x i8] c"1.2\00"
@.str.3 = [4 x i8] c"1.3\00"
@.str.4 = [4 x i8] c"1.5\00"
@.str.5 = [4 x i8] c"2.0\00"
@.str.6 = [4 x i8] c"2.5\00"
@.str.7 = [4 x i8] c"3.0\00"
@.str.8 = [4 x i8] c"3.5\00"
@.str.9 = [4 x i8] c"4.0\00"
@.str.10 = [4 x i8] c"4.5\00"
@.str.11 = [4 x i8] c"5.0\00"
@.str.12 = [4 x i8] c"5.5\00"
@.str.13 = [4 x i8] c"6.0\00"
@.str.14 = [4 x i8] c"7.0\00"
@.str.15 = [4 x i8] c"8.0\00"
@reltable.print_ext_speed.34 = internal unnamed_addr constant [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.16 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.17 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.18 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.19 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.20 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.21 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.22 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.23 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.34 to i64)) to i32)]
@.str.16 = [5 x i8] c"1 ns\00"
@.str.17 = [6 x i8] c"10 ns\00"
@.str.18 = [7 x i8] c"100 ns\00"
@.str.19 = [5 x i8] c"1 us\00"
@.str.20 = [6 x i8] c"10 us\00"
@.str.21 = [7 x i8] c"100 us\00"
@.str.22 = [5 x i8] c"1 ms\00"
@.str.23 = [6 x i8] c"10 ms\00"
@reltable.print_ext_speed.35 = internal unnamed_addr constant [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.24 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.25 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.26 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.27 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.28 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.29 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.30 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.31 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_ext_speed.35 to i64)) to i32)]
@.str.24 = [5 x i8] c"None\00"
@.str.25 = [3 x i8] c"10\00"
@.str.26 = [4 x i8] c"100\00"
@.str.27 = [6 x i8] c"1,000\00"
@.str.28 = [7 x i8] c"10,000\00"
@.str.29 = [8 x i8] c"100,000\00"
@.str.30 = [10 x i8] c"1,000,000\00"
@.str.31 = [11 x i8] c"10,000,000\00"
@.str.32 = [16 x i8] c"Speed = %s x %s\00"
@.str.33 = [15 x i8] c", scaled by %s\00"
define void @print_ext_speed(i32 %0, i32 %1) {
%3 = lshr i32 %0, 3
%4 = and i32 %3, 15
%5 = zext i32 %4 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.print_ext_speed to i8*), i64 %6)
%8 = and i32 %0, 7
%9 = zext i32 %8 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.print_ext_speed.34 to i8*), i64 %10)
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* %7, i8* %11)
%13 = icmp eq i32 %1, 0
br i1 %13, label %20, label %14
14: ; preds = %2
%15 = and i32 %1, 7
%16 = zext i32 %15 to i64
%17 = shl i64 %16, 2
%18 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.print_ext_speed.35 to i8*), i64 %17)
%19 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.33, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %14, %2
ret void
}