#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 radeon_rom_atom_clocks(unsigned char *bios, int master) {
  int pll_info_block = (*((unsigned short *)(bios + (master + 12))));
  if (pll_info_block == 0) {
    printf("No clock info block in BIOS\n");
    return;
  }
  printf("Clock info block:\n");
  printf("  SCLK    : %f\n",
         (*((unsigned int *)(bios + (pll_info_block + 8)))) / 100.0);
  printf("  MCLK    : %f\n",
         (*((unsigned int *)(bios + (pll_info_block + 12)))) / 100.0);
  printf("  RefClk  : %f\n",
         (*((unsigned short *)(bios + (pll_info_block + 82)))) / 100.0);
  printf("  PPLL Min: %f\n",
         (*((unsigned short *)(bios + (pll_info_block + 78)))) / 100.0);
  printf("  PPLL Max: %f\n",
         (*((unsigned int *)(bios + (pll_info_block + 32)))) / 100.0);
}


x86 assembly (clang, -O0):
<radeon_rom_atom_clocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0xc,%ecx
movslq %ecx,%rcx
movzwl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1150 <radeon_rom_atom_clocks+0x40>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1237 <radeon_rom_atom_clocks+0x127>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rax
mov    0x8(%rax,%rcx,1),%eax
cvtsi2sd %rax,%xmm0
movsd  0xe89(%rip),%xmm1
movsd  %xmm1,-0x20(%rbp)
divsd  %xmm1,%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
mov    %al,-0x11(%rbp)
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm1
mov    -0x11(%rbp),%al
mov    -0x8(%rbp),%rdx
movslq -0x10(%rbp),%rcx
mov    0xc(%rcx,%rdx,1),%ecx
cvtsi2sd %rcx,%xmm0
divsd  %xmm1,%xmm0
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm1
mov    -0x11(%rbp),%al
mov    -0x8(%rbp),%rdx
movslq -0x10(%rbp),%rcx
movzwl 0x52(%rcx,%rdx,1),%ecx
cvtsi2sd %ecx,%xmm0
divsd  %xmm1,%xmm0
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm1
mov    -0x11(%rbp),%al
mov    -0x8(%rbp),%rdx
movslq -0x10(%rbp),%rcx
movzwl 0x4e(%rcx,%rdx,1),%ecx
cvtsi2sd %ecx,%xmm0
divsd  %xmm1,%xmm0
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rax
mov    0x20(%rax,%rcx,1),%eax
cvtsi2sd %rax,%xmm0
movsd  0xddb(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe48(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radeon_rom_atom_clocks>:
push   %r14
push   %rbx
push   %rax
movslq %esi,%rax
movzwl 0xc(%rax,%rdi,1),%ebx
test   %rbx,%rbx
je     11f7 <radeon_rom_atom_clocks+0xd7>
mov    %rdi,%r14
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx,%r14,1),%eax
cvtsi2sd %rax,%xmm0
divsd  0xeaa(%rip),%xmm0
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0xc(%rbx,%r14,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xe87(%rip),%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movzwl 0x52(%rbx,%r14,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xe64(%rip),%xmm0
lea    0xe85(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movzwl 0x4e(%rbx,%r14,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xe41(%rip),%xmm0
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x20(%rbx,%r14,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xe1e(%rip),%xmm0
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
lea    0xe6c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"No clock info block in BIOS\0A\00"
@.str.1 = [19 x i8] c"Clock info block:\0A\00"
@.str.2 = [16 x i8] c" SCLK : %f\0A\00"
@.str.3 = [16 x i8] c" MCLK : %f\0A\00"
@.str.4 = [16 x i8] c" RefClk : %f\0A\00"
@.str.5 = [16 x i8] c" PPLL Min: %f\0A\00"
@.str.6 = [16 x i8] c" PPLL Max: %f\0A\00"
define void @radeon_rom_atom_clocks(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 12
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = bitcast i8* %10 to i16*
%12 = load i16, i16* %11
%13 = zext i16 %12 to i32
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %72
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%20 = load i8*, i8** %3
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = bitcast i8* %24 to i32*
%26 = load i32, i32* %25
%27 = uitofp i32 %26 to double
%28 = fdiv double %27, 1.000000e+02
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = load i8*, i8** %3
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 12
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %30, i64 %33
%35 = bitcast i8* %34 to i32*
%36 = load i32, i32* %35
%37 = uitofp i32 %36 to double
%38 = fdiv double %37, 1.000000e+02
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %38)
%40 = load i8*, i8** %3
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 82
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %40, i64 %43
%45 = bitcast i8* %44 to i16*
%46 = load i16, i16* %45
%47 = zext i16 %46 to i32
%48 = sitofp i32 %47 to double
%49 = fdiv double %48, 1.000000e+02
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %49)
%51 = load i8*, i8** %3
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 78
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %51, i64 %54
%56 = bitcast i8* %55 to i16*
%57 = load i16, i16* %56
%58 = zext i16 %57 to i32
%59 = sitofp i32 %58 to double
%60 = fdiv double %59, 1.000000e+02
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %60)
%62 = load i8*, i8** %3
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 32
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %62, i64 %65
%67 = bitcast i8* %66 to i32*
%68 = load i32, i32* %67
%69 = uitofp i32 %68 to double
%70 = fdiv double %69, 1.000000e+02
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %70)
br label %72
72: ; preds = %18, %16
ret void
}

LLVM IR (-O2):
@.str.2 = [16 x i8] c" SCLK : %f\0A\00"
@.str.3 = [16 x i8] c" MCLK : %f\0A\00"
@.str.4 = [16 x i8] c" RefClk : %f\0A\00"
@.str.5 = [16 x i8] c" PPLL Min: %f\0A\00"
@.str.6 = [16 x i8] c" PPLL Max: %f\0A\00"
@str = [18 x i8] c"Clock info block:\00"
@str.7 = [28 x i8] c"No clock info block in BIOS\00"
define void @radeon_rom_atom_clocks(i8* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, 12
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = bitcast i8* %5 to i16*
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = icmp eq i16 %7, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
br label %54
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%14 = add nuw nsw i32 %8, 8
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = bitcast i8* %16 to i32*
%18 = load i32, i32* %17
%19 = uitofp i32 %18 to double
%20 = fdiv double %19, 1.000000e+02
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %20)
%22 = add nuw nsw i32 %8, 12
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %0, i64 %23
%25 = bitcast i8* %24 to i32*
%26 = load i32, i32* %25
%27 = uitofp i32 %26 to double
%28 = fdiv double %27, 1.000000e+02
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %28)
%30 = add nuw nsw i32 %8, 82
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = bitcast i8* %32 to i16*
%34 = load i16, i16* %33
%35 = uitofp i16 %34 to double
%36 = fdiv double %35, 1.000000e+02
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %36)
%38 = add nuw nsw i32 %8, 78
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %0, i64 %39
%41 = bitcast i8* %40 to i16*
%42 = load i16, i16* %41
%43 = uitofp i16 %42 to double
%44 = fdiv double %43, 1.000000e+02
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %44)
%46 = add nuw nsw i32 %8, 32
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %0, i64 %47
%49 = bitcast i8* %48 to i32*
%50 = load i32, i32* %49
%51 = uitofp i32 %50 to double
%52 = fdiv double %51, 1.000000e+02
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), double %52)
br label %54
54: ; preds = %12, %10
ret void
}