#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_k14(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 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;
  }
  dramclock = fsb * dramratio;
  print_cpu_line(dramclock, fsb, 3);
}


x86 assembly (clang, -O0):
<poll_fsb_k14>:
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    $0xfffffffffffffffa,%rax
mov    %rax,-0x28(%rbp)
sub    $0xc,%rax
ja     1183 <poll_fsb_k14+0x63>
mov    -0x28(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1188 <poll_fsb_k14+0x68>
movsd  0xe88(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11cb <poll_fsb_k14+0xab>
movsd  0xe6e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11cb <poll_fsb_k14+0xab>
movsd  0xe54(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11cb <poll_fsb_k14+0xab>
movsd  0xe3a(%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_k14>:
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
add    $0xfffffffffffffffa,%rax
rol    $0x3e,%rax
lea    -0x1(%rax),%rcx
cmp    $0x2,%rcx
ja     1168 <poll_fsb_k14+0x48>
lea    0xeb0(%rip),%rcx
movsd  -0x8(%rcx,%rax,8),%xmm0
jmp    1170 <poll_fsb_k14+0x50>
movsd  0xe90(%rip),%xmm0
movsd  0xe90(%rip),%xmm1
mov    $0x3,%edi
call   1040 <print_cpu_line@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @poll_fsb_k14() {
%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 6, label %9
i64 10, label %10
i64 14, label %11
i64 18, label %12
]
8: ; preds = %0
br label %9
9: ; preds = %0, %8
store double 4.000000e+00, double* %2
br label %13
10: ; preds = %0
store double 0x4015555560000000, double* %2
br label %13
11: ; preds = %0
store double 0x401AAAAAA0000000, double* %2
br label %13
12: ; preds = %0
store double 8.000000e+00, double* %2
br label %13
13: ; preds = %12, %11, %10, %9
%14 = load double, double* %4
%15 = load double, double* %2
%16 = fmul double %14, %15
store double %16, double* %3
%17 = load double, double* %3
%18 = load double, double* %4
%19 = call i32 @print_cpu_line(double %17, double %18, i32 3)
ret void
}

LLVM IR (-O2):
@switch.table.poll_fsb_k14 = [3 x double] [double 0x4080AAAAB3000000, double 0x4084D5554D000000, double 8.000000e+02]
define void @poll_fsb_k14() {
%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
%6 = add nsw i64 %5, -6
%7 = call i64 @llvm.fshl.i64(i64 %6, i64 %6, i64 62)
%8 = add i64 %7, -1
%9 = icmp ult i64 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = getelementptr inbounds [3 x double], [3 x double]* @switch.table.poll_fsb_k14, i64 0, i64 %8
%12 = load double, double* %11
br label %13
13: ; preds = %10, %0
%14 = phi double [ 4.000000e+02, %0 ], [ %12, %10 ]
%15 = call i32 @print_cpu_line(double %14, double 1.000000e+02, i32 3)
ret void
}