#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*/ pci_conf_read(int /*<<< orphan*/, int, int, int, int,
                                 unsigned long *);
int /*<<< orphan*/ print_cpu_line(double, double, int);
void poll_fsb_k16(void) {
  unsigned long dramchr;
  double dramratio, dramclock, fsb;
  fsb = 100.0f;
  pci_conf_read(0, 24, 2, 0x94, 4, &dramchr);
  switch (dramchr & 0x1F) {
  default:
  case 0x04:
    dramratio = 10.0f / 3.0f;
    break;
  case 0x06:
    dramratio = 4.0f;
    break;
  case 0x0A:
    dramratio = 16.0f / 3.0f;
    break;
  case 0x0E:
    dramratio = 20.0f / 3.0f;
    break;
  case 0x12:
    dramratio = 8.0f;
    break;
  case 0x16:
    dramratio = 28.0f / 3.0f;
    break;
  case 0x19:
    dramratio = 21.0f / 2.0f;
    break;
  case 0x1A:
    dramratio = 32.0f / 3.0f;
    break;
  }
  dramclock = fsb * dramratio;
  print_cpu_line(dramclock, fsb, 3);
}


x86 assembly (clang, -O0):
<poll_fsb_k16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movabs $0x4059000000000000,%rax
mov    %rax,-0x20(%rbp)
xor    %edi,%edi
mov    $0x18,%esi
mov    $0x2,%edx
mov    $0x94,%ecx
mov    $0x4,%r8d
lea    -0x8(%rbp),%r9
call   1030 <pci_conf_read@plt>
mov    -0x8(%rbp),%rax
and    $0x1f,%eax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x28(%rbp)
sub    $0x16,%rax
ja     1183 <poll_fsb_k16+0x63>
mov    -0x28(%rbp),%rax
lea    0xec6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1188 <poll_fsb_k16+0x68>
movsd  0xea8(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1213 <poll_fsb_k16+0xf3>
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1213 <poll_fsb_k16+0xf3>
movsd  0xe74(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1213 <poll_fsb_k16+0xf3>
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1213 <poll_fsb_k16+0xf3>
movsd  0xe40(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1213 <poll_fsb_k16+0xf3>
movsd  0xe26(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1213 <poll_fsb_k16+0xf3>
movsd  0xe0c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1213 <poll_fsb_k16+0xf3>
movsd  0xdf2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    $0x3,%edi
call   1040 <print_cpu_line@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poll_fsb_k16>:
push   %rax
mov    %rsp,%r9
xor    %edi,%edi
mov    $0x18,%esi
mov    $0x2,%edx
mov    $0x94,%ecx
mov    $0x4,%r8d
call   1030 <pci_conf_read@plt>
mov    (%rsp),%rax
and    $0x1f,%eax
movsd  0xeb1(%rip),%xmm0
add    $0xfffffffffffffffa,%rax
cmp    $0x14,%rax
ja     11ad <poll_fsb_k16+0x8d>
lea    0xee8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xebf(%rip),%xmm0
jmp    11ad <poll_fsb_k16+0x8d>
movsd  0xead(%rip),%xmm0
jmp    11ad <poll_fsb_k16+0x8d>
movsd  0xe9b(%rip),%xmm0
jmp    11ad <poll_fsb_k16+0x8d>
movsd  0xe89(%rip),%xmm0
jmp    11ad <poll_fsb_k16+0x8d>
movsd  0xe6f(%rip),%xmm0
jmp    11ad <poll_fsb_k16+0x8d>
movsd  0xe95(%rip),%xmm0
jmp    11ad <poll_fsb_k16+0x8d>
movsd  0xe63(%rip),%xmm0
movsd  0xe8b(%rip),%xmm1
mov    $0x3,%edi
call   1040 <print_cpu_line@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @poll_fsb_k16() {
%1 = alloca i64
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double 1.000000e+02, double* %4
%5 = call i32 @pci_conf_read(i32 0, i32 24, i32 2, i32 148, i32 4, i64* %1)
%6 = load i64, i64* %1
%7 = and i64 %6, 31
switch i64 %7, label %8 [
i64 4, label %9
i64 6, label %10
i64 10, label %11
i64 14, label %12
i64 18, label %13
i64 22, label %14
i64 25, label %15
i64 26, label %16
]
8: ; preds = %0
br label %9
9: ; preds = %0, %8
store double 0x400AAAAAA0000000, double* %2
br label %17
10: ; preds = %0
store double 4.000000e+00, double* %2
br label %17
11: ; preds = %0
store double 0x4015555560000000, double* %2
br label %17
12: ; preds = %0
store double 0x401AAAAAA0000000, double* %2
br label %17
13: ; preds = %0
store double 8.000000e+00, double* %2
br label %17
14: ; preds = %0
store double 0x4022AAAAA0000000, double* %2
br label %17
15: ; preds = %0
store double 1.050000e+01, double* %2
br label %17
16: ; preds = %0
store double 0x4025555560000000, double* %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9
%18 = load double, double* %4
%19 = load double, double* %2
%20 = fmul double %18, %19
store double %20, double* %3
%21 = load double, double* %3
%22 = load double, double* %4
%23 = call i32 @print_cpu_line(double %21, double %22, i32 3)
ret void
}

LLVM IR (-O2):
define void @poll_fsb_k16() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @pci_conf_read(i32 0, i32 24, i32 2, i32 148, i32 4, i64* %1)
%4 = load i64, i64* %1
%5 = and i64 %4, 31
switch i64 %5, label %13 [
i64 26, label %12
i64 6, label %6
i64 10, label %7
i64 14, label %8
i64 18, label %9
i64 22, label %10
i64 25, label %11
]
6: ; preds = %0
br label %13
7: ; preds = %0
br label %13
8: ; preds = %0
br label %13
9: ; preds = %0
br label %13
10: ; preds = %0
br label %13
11: ; preds = %0
br label %13
12: ; preds = %0
br label %13
13: ; preds = %0, %12, %11, %10, %9, %8, %7, %6
%14 = phi double [ 1.050000e+03, %11 ], [ 0x408D2AAA9A000000, %10 ], [ 8.000000e+02, %9 ], [ 0x4084D5554D000000, %8 ], [ 0x4080AAAAB3000000, %7 ], [ 4.000000e+02, %6 ], [ 0x4090AAAAB3000000, %12 ], [ 0x4074D5554D000000, %0 ]
%15 = call i32 @print_cpu_line(double %14, double 1.000000e+02, i32 3)
ret void
}