int main(int argc, char *argv[]) {
  int i, PRINT_REGISTERS = 0, PRINT_TIMINGS = 1, PRINT_SPD = 0, PRINT_HELP = 0;
  unsigned bus = 0xff, dev = 0x4, func = 0;
  if (argc > 1)
    for (i = 1; i < argc; i++)
      if (argv[i][0] == '-' || argv[i][0] == '~')
        switch (argv[i][1]) {
        case 'b':
          if (argv[i + 1])
            bus = atoi(argv[++i]);
          else
            PRINT_HELP = 1;
          break;
        case 'd':
          if (argv[i + 1])
            dev = atoi(argv[++i]);
          else
            PRINT_HELP = 1;
          break;
        case 'f':
          if (argv[i + 1])
            func = atoi(argv[++i]);
          else
            PRINT_HELP = 1;
          break;
        case 'r':
          PRINT_REGISTERS = (argv[i][0] == '~') ? 0 : 1;
          break;
        case 't':
          PRINT_TIMINGS = (argv[i][0] == '~') ? 0 : 1;
          break;
        case 's':
          PRINT_SPD = (argv[i][0] == '~') ? 0 : 1;
          break;
        case 'h':
        default:
          PRINT_HELP = 1;
          break;
        }
      else
        PRINT_HELP = 1;
  if (!PRINT_HELP) {
    if (!geteuid() && !iopl(3)) {
      int MRs = 0, RANK_TIMING_B = 0, BANK_TIMING = 0, REFRESH_TIMING = 0,
          tCL = 0, tRCD = 0, tRP = 0, tRAS = 0, tRRD = 0, tRFC = 0, tWR = 0,
          tWTPr = 0, tRTPr = 0, tFAW = 0, B2B = 0;
      int code, channelCount = 0;
      char *confChanStr[] = {"Zero", "Single", "Dual", "Triple"};
      printf("Ready to Request I/O in PCI device %x:%u.%u\n\n", bus, dev, func);
      outl((0x80000000 | (bus << 16) | (3 << 11) | (0 << 8) | (0x48 & ~3)),
           0xcf8);
      code = inw(0xcfc + (0x48 & 2));
      code = (code >> 8) & 0x7;
      channelCount = (code == 7   ? 3
                      : code == 4 ? 1
                      : code == 2 ? 1
                      : code == 1 ? 1
                                  : 2);
      printf("IMC %x:3.0 Memory Controler is a %s(%d) Channel.\n\n", bus,
             confChanStr[channelCount], code);
      printf("DDR   tCL   tRCD  tRP   tRAS  tRRD  tRFC  tWR   tWTPr tRTPr tFAW "
             " B2B   \n");
      for (i = 0; i < channelCount; i++) {
        outl((0x80000000 | (bus << 16) | (dev + i << 11) | (func << 8) |
              (0x70 & ~3)),
             0xcf8);
        MRs = inl(0xcfc);
        outl((0x80000000 | (bus << 16) | (dev + i << 11) | (func << 8) |
              (0x84 & ~3)),
             0xcf8);
        RANK_TIMING_B = inl(0xcfc);
        outl((0x80000000 | (bus << 16) | (dev + i << 11) | (func << 8) |
              (0x88 & ~3)),
             0xcf8);
        BANK_TIMING = inl(0xcfc);
        outl((0x80000000 | (bus << 16) | (dev + i << 11) | (func << 8) |
              (0x8c & ~3)),
             0xcf8);
        REFRESH_TIMING = inl(0xcfc);
        tCL = ((MRs >> 4) & 0x7);
        if (tCL != 0)
          tCL += 4;
        tRCD = (BANK_TIMING & 0x1E00) >> 9;
        tRP = (BANK_TIMING & 0xF);
        tRAS = (BANK_TIMING & 0x1F0) >> 4;
        tRRD = (RANK_TIMING_B & 0x1c0) >> 6;
        tRFC = (REFRESH_TIMING & 0x1ff);
        tWR = ((MRs >> 9) & 0x7);
        if (tWR != 0)
          tWR += 4;
        tWTPr = (BANK_TIMING & 0x3E0000) >> 17;
        tRTPr = (BANK_TIMING & 0x1E000) >> 13;
        tFAW = (RANK_TIMING_B & 0x3f);
        B2B = (RANK_TIMING_B & 0x1f0000) >> 16;
        if (PRINT_TIMINGS)
          printf(" #%1i |%4d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d\n", i, tCL, tRCD,
                 tRP, tRAS, tRRD, tRFC, tWR, tWTPr, tRTPr, tFAW, B2B);
        if (PRINT_REGISTERS) {
          printf("    |\tMC_CHANNEL_%1i_RANK_TIMING_B  [0x%08x]\n", i,
                 RANK_TIMING_B);
          printf("    |\tMC_CHANNEL_%1i_BANK_TIMING    [0x%08x]\n", i,
                 BANK_TIMING);
          printf("    |\tMC_CHANNEL_%1i_REFRESH_TIMING [0x%08x]\n", i,
                 REFRESH_TIMING);
          printf("    |\tMC_CHANNEL_%1i_MRS_VALUES     [0x%08x]\n", i, MRs);
        }
      }
      if (PRINT_SPD) {
        printf("\nSPD: not implemented yet !\n");
      }
      iopl(0);
    } else
      printf("%s: Must be root !\n", argv[0]);
  } else
    printf("Usage: %s [OPTION]\n"
           "-r / ~r         print / hide raw register values\n"
           "-t / ~t         print / hide timings (default)\n"
           "-s / ~s         print / hide SPD\n"
           "-b <num>        use the specified bus id\n"
           "-d <num>        use the specified device id\n"
           "-f <num>        use the specified function number\n"
           "-h              give this help list\n",
           argv[0]);
  return (!PRINT_HELP ? 0 : -1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xf0,%rsp
movl   $0x0,-0x24(%rbp)
mov    %edi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0xff,-0x48(%rbp)
movl   $0x4,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
cmpl   $0x1,-0x28(%rbp)
jle    13bb <main+0x24b>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13b6 <main+0x246>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     120e <main+0x9e>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x7e,%eax
jne    139c <main+0x22c>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0xc8(%rbp)
sub    $0x12,%eax
ja     1390 <main+0x220>
mov    -0xc8(%rbp),%rax
lea    0xdbf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1285 <main+0x115>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1090 <atoi@plt>
mov    %eax,-0x48(%rbp)
jmp    128c <main+0x11c>
movl   $0x1,-0x44(%rbp)
jmp    1397 <main+0x227>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     12cc <main+0x15c>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1090 <atoi@plt>
mov    %eax,-0x4c(%rbp)
jmp    12d3 <main+0x163>
movl   $0x1,-0x44(%rbp)
jmp    1397 <main+0x227>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1313 <main+0x1a3>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1090 <atoi@plt>
mov    %eax,-0x50(%rbp)
jmp    131a <main+0x1aa>
movl   $0x1,-0x44(%rbp)
jmp    1397 <main+0x227>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x7e,%edx
cmove  %ecx,%eax
mov    %eax,-0x38(%rbp)
jmp    1397 <main+0x227>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x7e,%edx
cmove  %ecx,%eax
mov    %eax,-0x3c(%rbp)
jmp    1397 <main+0x227>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x7e,%edx
cmove  %ecx,%eax
mov    %eax,-0x40(%rbp)
jmp    1397 <main+0x227>
jmp    1390 <main+0x220>
movl   $0x1,-0x44(%rbp)
jmp    13a3 <main+0x233>
movl   $0x1,-0x44(%rbp)
jmp    13a8 <main+0x238>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d2 <main+0x62>
jmp    13bb <main+0x24b>
cmpl   $0x0,-0x44(%rbp)
jne    18ac <main+0x73c>
mov    $0x0,%al
call   1060 <geteuid@plt>
cmp    $0x0,%eax
jne    1892 <main+0x722>
mov    $0x3,%edi
mov    $0x0,%al
call   1050 <iopl@plt>
cmp    $0x0,%eax
jne    1892 <main+0x722>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x94(%rbp)
mov    0x2993(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0x298d(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    0x2987(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    0x2981(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x48(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    -0x50(%rbp),%ecx
lea    0xbb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%edi
shl    $0x10,%edi
or     $0x80000000,%edi
or     $0x1800,%edi
or     $0x0,%edi
or     $0x48,%edi
mov    $0xcf8,%esi
mov    $0x0,%al
call   1070 <outl@plt>
mov    $0xcfc,%edi
mov    $0x0,%al
call   1030 <inw@plt>
mov    %eax,-0x90(%rbp)
mov    -0x90(%rbp),%eax
sar    $0x8,%eax
and    $0x7,%eax
mov    %eax,-0x90(%rbp)
cmpl   $0x7,-0x90(%rbp)
jne    151a <main+0x3aa>
mov    $0x3,%eax
mov    %eax,-0xcc(%rbp)
jmp    1588 <main+0x418>
cmpl   $0x4,-0x90(%rbp)
jne    1537 <main+0x3c7>
mov    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    157c <main+0x40c>
cmpl   $0x2,-0x90(%rbp)
jne    1554 <main+0x3e4>
mov    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1570 <main+0x400>
mov    -0x90(%rbp),%edx
mov    $0x2,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %eax,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x48(%rbp),%esi
movslq -0x94(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdx
ff
mov    -0x90(%rbp),%ecx
lea    0xadf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    186c <main+0x6fc>
mov    -0x48(%rbp),%edi
shl    $0x10,%edi
or     $0x80000000,%edi
mov    -0x4c(%rbp),%eax
add    -0x34(%rbp),%eax
shl    $0xb,%eax
or     %eax,%edi
mov    -0x50(%rbp),%eax
shl    $0x8,%eax
or     %eax,%edi
or     $0x70,%edi
mov    $0xcf8,%esi
mov    $0x0,%al
call   1070 <outl@plt>
mov    $0xcfc,%edi
mov    $0x0,%al
call   1080 <inl@plt>
mov    %eax,-0x54(%rbp)
mov    -0x48(%rbp),%edi
shl    $0x10,%edi
or     $0x80000000,%edi
mov    -0x4c(%rbp),%eax
add    -0x34(%rbp),%eax
shl    $0xb,%eax
or     %eax,%edi
mov    -0x50(%rbp),%eax
shl    $0x8,%eax
or     %eax,%edi
or     $0x84,%edi
mov    $0xcf8,%esi
mov    $0x0,%al
call   1070 <outl@plt>
mov    $0xcfc,%edi
mov    $0x0,%al
call   1080 <inl@plt>
mov    %eax,-0x58(%rbp)
mov    -0x48(%rbp),%edi
shl    $0x10,%edi
or     $0x80000000,%edi
mov    -0x4c(%rbp),%eax
add    -0x34(%rbp),%eax
shl    $0xb,%eax
or     %eax,%edi
mov    -0x50(%rbp),%eax
shl    $0x8,%eax
or     %eax,%edi
or     $0x88,%edi
mov    $0xcf8,%esi
mov    $0x0,%al
call   1070 <outl@plt>
mov    $0xcfc,%edi
mov    $0x0,%al
call   1080 <inl@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%edi
shl    $0x10,%edi
or     $0x80000000,%edi
mov    -0x4c(%rbp),%eax
add    -0x34(%rbp),%eax
shl    $0xb,%eax
or     %eax,%edi
mov    -0x50(%rbp),%eax
shl    $0x8,%eax
or     %eax,%edi
or     $0x8c,%edi
mov    $0xcf8,%esi
mov    $0x0,%al
call   1070 <outl@plt>
mov    $0xcfc,%edi
mov    $0x0,%al
call   1080 <inl@plt>
mov    %eax,-0x60(%rbp)
mov    -0x54(%rbp),%eax
sar    $0x4,%eax
and    $0x7,%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
je     16fa <main+0x58a>
mov    -0x64(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x64(%rbp)
mov    -0x5c(%rbp),%eax
and    $0x1e00,%eax
sar    $0x9,%eax
mov    %eax,-0x68(%rbp)
mov    -0x5c(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x5c(%rbp),%eax
and    $0x1f0,%eax
sar    $0x4,%eax
mov    %eax,-0x70(%rbp)
mov    -0x58(%rbp),%eax
and    $0x1c0,%eax
sar    $0x6,%eax
mov    %eax,-0x74(%rbp)
mov    -0x60(%rbp),%eax
and    $0x1ff,%eax
mov    %eax,-0x78(%rbp)
mov    -0x54(%rbp),%eax
sar    $0x9,%eax
and    $0x7,%eax
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
je     1757 <main+0x5e7>
mov    -0x7c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x5c(%rbp),%eax
and    $0x3e0000,%eax
sar    $0x11,%eax
mov    %eax,-0x80(%rbp)
mov    -0x5c(%rbp),%eax
and    $0x1e000,%eax
sar    $0xd,%eax
mov    %eax,-0x84(%rbp)
mov    -0x58(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x88(%rbp)
mov    -0x58(%rbp),%eax
and    $0x1f0000,%eax
sar    $0x10,%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     17ff <main+0x68f>
mov    -0x34(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x68(%rbp),%ecx
mov    -0x6c(%rbp),%r8d
mov    -0x70(%rbp),%r9d
mov    -0x74(%rbp),%r12d
mov    -0x78(%rbp),%r15d
mov    -0x7c(%rbp),%r14d
mov    -0x80(%rbp),%ebx
mov    -0x84(%rbp),%r11d
mov    -0x88(%rbp),%r10d
mov    -0x8c(%rbp),%eax
lea    0x937(%rip),%rdi
mov    %r12d,(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r14d,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %eax,0x30(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x38(%rbp)
je     1859 <main+0x6e9>
mov    -0x34(%rbp),%esi
mov    -0x58(%rbp),%edx
lea    0x923(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%esi
mov    -0x5c(%rbp),%edx
lea    0x93d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%esi
mov    -0x60(%rbp),%edx
lea    0x957(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%esi
mov    -0x54(%rbp),%edx
lea    0x971(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    185e <main+0x6ee>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    15cf <main+0x45f>
cmpl   $0x0,-0x40(%rbp)
je     1884 <main+0x714>
lea    0x974(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x0,%al
call   1050 <iopl@plt>
jmp    18a7 <main+0x737>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
lea    0x96e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    18c1 <main+0x751>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
lea    0x968(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x44(%rbp)
setne  %dl
xor    $0xff,%dl
mov    $0xffffffff,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbp
cmp    $0x2,%edi
jl     12aa <main+0x12a>
mov    %edi,%ebx
movl   $0x1,0x20(%rsp)
movl   $0xff,0xc(%rsp)
movl   $0x4,0x14(%rsp)
lea    0xe45(%rip),%r13
movl   $0x0,0x10(%rsp)
xor    %eax,%eax
movl   $0x0,0x18(%rsp)
movl   $0x0,0x1c(%rsp)
mov    $0x1,%r14d
jmp    11f2 <main+0x72>
nopl   (%rax)
mov    $0x1,%eax
add    $0x1,%r14d
cmp    %ebx,%r14d
jge    12d3 <main+0x153>
mov    %eax,%r15d
movslq %r14d,%rdx
mov    0x0(%rbp,%rdx,8),%rax
movzbl (%rax),%ecx
cmp    $0x7e,%cl
je     120a <main+0x8a>
cmp    $0x2d,%cl
jne    11e0 <main+0x60>
movsbl 0x1(%rax),%eax
add    $0xffffff9e,%eax
cmp    $0x12,%eax
ja     11e0 <main+0x60>
movslq 0x0(%r13,%rax,4),%rsi
add    %r13,%rsi
mov    $0x1,%eax
jmp    *%rsi
mov    0x8(%rbp,%rdx,8),%rdi
test   %rdi,%rdi
je     11e0 <main+0x60>
add    $0x1,%r14d
xor    %eax,%eax
call   10a0 <atoi@plt>
mov    %eax,0xc(%rsp)
jmp    12a2 <main+0x122>
mov    0x8(%rbp,%rdx,8),%rdi
test   %rdi,%rdi
je     11e0 <main+0x60>
add    $0x1,%r14d
xor    %eax,%eax
call   10a0 <atoi@plt>
mov    %eax,0x14(%rsp)
jmp    12a2 <main+0x122>
mov    0x8(%rbp,%rdx,8),%rdi
test   %rdi,%rdi
je     11e0 <main+0x60>
add    $0x1,%r14d
xor    %eax,%eax
call   10a0 <atoi@plt>
mov    %eax,0x10(%rsp)
jmp    12a2 <main+0x122>
xor    %eax,%eax
cmp    $0x7e,%cl
setne  %al
mov    %eax,0x1c(%rsp)
jmp    12a2 <main+0x122>
xor    %eax,%eax
cmp    $0x7e,%cl
setne  %al
mov    %eax,0x18(%rsp)
jmp    12a2 <main+0x122>
xor    %eax,%eax
cmp    $0x7e,%cl
setne  %al
mov    %eax,0x20(%rsp)
mov    %r15d,%eax
jmp    11e5 <main+0x65>
movl   $0x1,0x20(%rsp)
mov    $0xff,%r13d
mov    $0x4,%r15d
xor    %r14d,%r14d
movl   $0x0,0x18(%rsp)
movl   $0x0,0x1c(%rsp)
jmp    12ff <main+0x17f>
test   %eax,%eax
mov    0x14(%rsp),%r15d
mov    0x10(%rsp),%r14d
mov    0xc(%rsp),%r13d
je     12ff <main+0x17f>
mov    0x0(%rbp),%rsi
lea    0xeda(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%ebx
jmp    132e <main+0x1ae>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <geteuid@plt>
test   %eax,%eax
jne    131c <main+0x19c>
mov    $0x3,%edi
xor    %eax,%eax
call   1060 <iopl@plt>
test   %eax,%eax
je     133f <main+0x1bf>
mov    0x0(%rbp),%rsi
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd2e(%rip),%rdi
mov    %r13d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
shl    $0x10,%edi
mov    %edi,0x24(%rsp)
or     $0x80001848,%edi
mov    $0xcf8,%esi
xor    %eax,%eax
call   1080 <outl@plt>
mov    $0xcfc,%edi
xor    %eax,%eax
call   1030 <inw@plt>
shr    $0x8,%eax
and    $0x7,%eax
cmp    $0x2,%eax
je     13a9 <main+0x229>
cmp    $0x4,%eax
je     13a9 <main+0x229>
cmp    $0x7,%eax
mov    $0x3,%ebx
je     13ae <main+0x22e>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    $0x2,%ebx
sub    %ecx,%ebx
jmp    13ae <main+0x22e>
mov    $0x1,%ebx
mov    %ebx,%ecx
lea    0xc95(%rip),%rsi
movslq (%rsi,%rcx,4),%rdx
add    %rsi,%rdx
lea    0xcdd(%rip),%rdi
mov    %r13d,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf33(%rip),%rdi
call   1040 <puts@plt>
shl    $0x8,%r14d
or     %r14d,0x24(%rsp)
shl    $0xb,%r15d
xor    %r14d,%r14d
mov    %ebx,%r13d
mov    %ebx,0x28(%rsp)
jmp    1414 <main+0x294>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r14d
add    $0x800,%r15d
cmp    %r14d,%r13d
je     15d4 <main+0x454>
mov    0x24(%rsp),%ebx
or     %r15d,%ebx
mov    %ebx,%edi
or     $0x80000070,%edi
mov    $0xcf8,%esi
xor    %eax,%eax
call   1080 <outl@plt>
mov    $0xcfc,%edi
xor    %eax,%eax
call   1090 <inl@plt>
mov    %eax,0x10(%rsp)
mov    %ebx,%edi
or     $0x80000084,%edi
mov    $0xcf8,%esi
xor    %eax,%eax
call   1080 <outl@plt>
mov    $0xcfc,%edi
xor    %eax,%eax
call   1090 <inl@plt>
mov    %eax,0xc(%rsp)
mov    %ebx,%edi
or     $0x80000088,%edi
mov    $0xcf8,%esi
xor    %eax,%eax
call   1080 <outl@plt>
mov    $0xcfc,%edi
xor    %eax,%eax
call   1090 <inl@plt>
mov    %eax,%ebp
or     $0x8000008c,%ebx
mov    %ebx,%edi
mov    $0xcf8,%esi
xor    %eax,%eax
call   1080 <outl@plt>
mov    $0xcfc,%edi
xor    %eax,%eax
call   1090 <inl@plt>
cmpl   $0x0,0x20(%rsp)
je     156e <main+0x3ee>
mov    0x10(%rsp),%ecx
mov    %ecx,%edi
shr    $0x4,%edi
and    $0x7,%edi
shr    $0x9,%ecx
and    $0x7,%ecx
lea    0x4(%rcx),%edx
test   %ecx,%ecx
cmove  %ecx,%edx
mov    %rdx,0x30(%rsp)
mov    %eax,%r11d
and    $0x1ff,%r11d
mov    %eax,0x2c(%rsp)
mov    0xc(%rsp),%esi
mov    %esi,%ebx
shr    $0x6,%ebx
and    $0x7,%ebx
mov    %ebp,%r9d
shr    $0x4,%r9d
and    $0x1f,%r9d
mov    %ebp,%r8d
and    $0xf,%r8d
mov    %ebp,%ecx
shr    $0x9,%ecx
and    $0xf,%ecx
lea    0x4(%rdi),%edx
test   %edi,%edi
cmove  %edi,%edx
mov    %r15d,0x14(%rsp)
mov    %esi,%r15d
shr    $0x10,%r15d
and    $0x1f,%r15d
mov    %esi,%r12d
and    $0x3f,%r12d
mov    %ebp,%r13d
shr    $0xd,%r13d
and    $0xf,%r13d
mov    %ebp,%r10d
shr    $0x11,%r10d
and    $0x1f,%r10d
sub    $0x8,%rsp
lea    0xb92(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
push   %r15
mov    0x24(%rsp),%r15d
push   %r12
push   %r13
mov    0x48(%rsp),%r13d
push   %r10
push   0x58(%rsp)
push   %r11
push   %rbx
call   1050 <printf@plt>
mov    0x6c(%rsp),%eax
add    $0x40,%rsp
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ebx
cmpl   $0x0,0x1c(%rsp)
je     1400 <main+0x280>
lea    0xb77(%rip),%rdi
mov    %eax,%r12d
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xb91(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbac(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbc6(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1400 <main+0x280>
cmpl   $0x0,0x18(%rsp)
je     15e7 <main+0x467>
lea    0xd72(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
xor    %edi,%edi
xor    %eax,%eax
call   1060 <iopl@plt>
jmp    132e <main+0x1ae>

LLVM IR (-O0):
@.str = [5 x i8] c"Zero\00"
@.str.1 = [7 x i8] c"Single\00"
@.str.2 = [5 x i8] c"Dual\00"
@.str.3 = [7 x i8] c"Triple\00"
@__const.main.confChanStr = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [46 x i8] c"Ready to Request I/O in PCI device %x:%u.%u\0A\0A\00"
@.str.5 = [51 x i8] c"IMC %x:3.0 Memory Controler is a %s(%d) Channel.\0A\0A\00"
@.str.6 = [74 x i8] c"DDR tCL tRCD tRP tRAS tRRD tRFC tWR tWTPr tRTPr tFAW B2B \0A\00"
@.str.7 = [42 x i8] c" #%1i |%4d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d\0A\00"
@.str.8 = [46 x i8] c" |\09MC_CHANNEL_%1i_RANK_TIMING_B [0x%08x]\0A\00"
@.str.9 = [46 x i8] c" |\09MC_CHANNEL_%1i_BANK_TIMING [0x%08x]\0A\00"
@.str.10 = [46 x i8] c" |\09MC_CHANNEL_%1i_REFRESH_TIMING [0x%08x]\0A\00"
@.str.11 = [46 x i8] c" |\09MC_CHANNEL_%1i_MRS_VALUES [0x%08x]\0A\00"
@.str.12 = [29 x i8] c"\0ASPD: not implemented yet !\0A\00"
@.str.13 = [20 x i8] c"%s: Must be root !\0A\00"
@.str.14 = [320 x i8] c"Usage: %s [OPTION]\0A-r / ~r print / hide raw register values\0A-t / ~t print / hide timings (default)\0A-s / ~s print / hide SPD\0A-b <num> use the specified bus id\0A-d <num> use the specified device id\0A-f <num> use the specified function number\0A-h give this help list\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca [4 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 1, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 255, i32* %11
store i32 4, i32* %12
store i32 0, i32* %13
%32 = load i32, i32* %4
%33 = icmp sgt i32 %32, 1
br i1 %33, label %34, label %167
34: ; preds = %2
store i32 1, i32* %6
br label %35
35: ; preds = %163, %34
%36 = load i32, i32* %6
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %166
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = getelementptr inbounds i8, i8* %44, i64 0
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 45
br i1 %48, label %59, label %49
49: ; preds = %39
%50 = load i8**, i8*** %5
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = getelementptr inbounds i8, i8* %54, i64 0
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 126
br i1 %58, label %59, label %161
59: ; preds = %49, %39
%60 = load i8**, i8*** %5
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = getelementptr inbounds i8, i8* %64, i64 1
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
switch i32 %67, label %159 [
i32 98, label %68
i32 100, label %86
i32 102, label %104
i32 114, label %122
i32 116, label %134
i32 115, label %146
i32 104, label %158
]
68: ; preds = %59
%69 = load i8**, i8*** %5
%70 = load i32, i32* %6
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %69, i64 %72
%74 = load i8*, i8** %73
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %84
76: ; preds = %68
%77 = load i8**, i8*** %5
%78 = load i32, i32* %6
%79 = add nsw i32 %78, 1
store i32 %79, i32* %6
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8*, i8** %77, i64 %80
%82 = load i8*, i8** %81
%83 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %82)
store i32 %83, i32* %11
br label %85
84: ; preds = %68
store i32 1, i32* %10
br label %85
85: ; preds = %84, %76
br label %160
86: ; preds = %59
%87 = load i8**, i8*** %5
%88 = load i32, i32* %6
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8*, i8** %87, i64 %90
%92 = load i8*, i8** %91
%93 = icmp ne i8* %92, null
br i1 %93, label %94, label %102
94: ; preds = %86
%95 = load i8**, i8*** %5
%96 = load i32, i32* %6
%97 = add nsw i32 %96, 1
store i32 %97, i32* %6
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8*, i8** %95, i64 %98
%100 = load i8*, i8** %99
%101 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %100)
store i32 %101, i32* %12
br label %103
102: ; preds = %86
store i32 1, i32* %10
br label %103
103: ; preds = %102, %94
br label %160
104: ; preds = %59
%105 = load i8**, i8*** %5
%106 = load i32, i32* %6
%107 = add nsw i32 %106, 1
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8*, i8** %105, i64 %108
%110 = load i8*, i8** %109
%111 = icmp ne i8* %110, null
br i1 %111, label %112, label %120
112: ; preds = %104
%113 = load i8**, i8*** %5
%114 = load i32, i32* %6
%115 = add nsw i32 %114, 1
store i32 %115, i32* %6
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i8*, i8** %113, i64 %116
%118 = load i8*, i8** %117
%119 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %118)
store i32 %119, i32* %13
br label %121
120: ; preds = %104
store i32 1, i32* %10
br label %121
121: ; preds = %120, %112
br label %160
122: ; preds = %59
%123 = load i8**, i8*** %5
%124 = load i32, i32* %6
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8*, i8** %123, i64 %125
%127 = load i8*, i8** %126
%128 = getelementptr inbounds i8, i8* %127, i64 0
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp eq i32 %130, 126
%132 = zext i1 %131 to i64
%133 = select i1 %131, i32 0, i32 1
store i32 %133, i32* %7
br label %160
134: ; preds = %59
%135 = load i8**, i8*** %5
%136 = load i32, i32* %6
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8*, i8** %135, i64 %137
%139 = load i8*, i8** %138
%140 = getelementptr inbounds i8, i8* %139, i64 0
%141 = load i8, i8* %140
%142 = sext i8 %141 to i32
%143 = icmp eq i32 %142, 126
%144 = zext i1 %143 to i64
%145 = select i1 %143, i32 0, i32 1
store i32 %145, i32* %8
br label %160
146: ; preds = %59
%147 = load i8**, i8*** %5
%148 = load i32, i32* %6
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8*, i8** %147, i64 %149
%151 = load i8*, i8** %150
%152 = getelementptr inbounds i8, i8* %151, i64 0
%153 = load i8, i8* %152
%154 = sext i8 %153 to i32
%155 = icmp eq i32 %154, 126
%156 = zext i1 %155 to i64
%157 = select i1 %155, i32 0, i32 1
store i32 %157, i32* %9
br label %160
158: ; preds = %59
br label %159
159: ; preds = %59, %158
store i32 1, i32* %10
br label %160
160: ; preds = %159, %146, %134, %122, %121, %103, %85
br label %162
161: ; preds = %49
store i32 1, i32* %10
br label %162
162: ; preds = %161, %160
br label %163
163: ; preds = %162
%164 = load i32, i32* %6
%165 = add nsw i32 %164, 1
store i32 %165, i32* %6
br label %35
166: ; preds = %35
br label %167
167: ; preds = %166, %2
%168 = load i32, i32* %10
%169 = icmp ne i32 %168, 0
br i1 %169, label %375, label %170
170: ; preds = %167
%171 = call i32 (...) @geteuid()
%172 = icmp ne i32 %171, 0
br i1 %172, label %369, label %173
173: ; preds = %170
%174 = call i32 (i32, ...) bitcast (i32 (...)* @iopl to i32 (i32, ...)*)(i32 3)
%175 = icmp ne i32 %174, 0
br i1 %175, label %369, label %176
176: ; preds = %173
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
store i32 0, i32* %22
store i32 0, i32* %23
store i32 0, i32* %24
store i32 0, i32* %25
store i32 0, i32* %26
store i32 0, i32* %27
store i32 0, i32* %28
store i32 0, i32* %30
%177 = bitcast [4 x i8*]* %31 to i8*
%178 = load i32, i32* %11
%179 = load i32, i32* %12
%180 = load i32, i32* %13
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i32 %178, i32 %179, i32 %180)
%182 = load i32, i32* %11
%183 = shl i32 %182, 16
%184 = or i32 -2147483648, %183
%185 = or i32 %184, 6144
%186 = or i32 %185, 0
%187 = or i32 %186, 72
%188 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %187, i32 3320)
%189 = call i32 (i32, ...) bitcast (i32 (...)* @inw to i32 (i32, ...)*)(i32 3324)
store i32 %189, i32* %29
%190 = load i32, i32* %29
%191 = ashr i32 %190, 8
%192 = and i32 %191, 7
store i32 %192, i32* %29
%193 = load i32, i32* %29
%194 = icmp eq i32 %193, 7
br i1 %194, label %195, label %196
195: ; preds = %176
br label %213
196: ; preds = %176
%197 = load i32, i32* %29
%198 = icmp eq i32 %197, 4
br i1 %198, label %199, label %200
199: ; preds = %196
br label %211
200: ; preds = %196
%201 = load i32, i32* %29
%202 = icmp eq i32 %201, 2
br i1 %202, label %203, label %204
203: ; preds = %200
br label %209
204: ; preds = %200
%205 = load i32, i32* %29
%206 = icmp eq i32 %205, 1
%207 = zext i1 %206 to i64
%208 = select i1 %206, i32 1, i32 2
br label %209
209: ; preds = %204, %203
%210 = phi i32 [ 1, %203 ], [ %208, %204 ]
br label %211
211: ; preds = %209, %199
%212 = phi i32 [ 1, %199 ], [ %210, %209 ]
br label %213
213: ; preds = %211, %195
%214 = phi i32 [ 3, %195 ], [ %212, %211 ]
store i32 %214, i32* %30
%215 = load i32, i32* %11
%216 = load i32, i32* %30
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds [4 x i8*], [4 x i8*]* %31, i64 0, i64 %217
%219 = load i8*, i8** %218
%220 = load i32, i32* %29
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i32 %215, i8* %219, i32 %220)
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %6
br label %223
223: ; preds = %359, %213
%224 = load i32, i32* %6
%225 = load i32, i32* %30
%226 = icmp slt i32 %224, %225
br i1 %226, label %227, label %362
227: ; preds = %223
%228 = load i32, i32* %11
%229 = shl i32 %228, 16
%230 = or i32 -2147483648, %229
%231 = load i32, i32* %12
%232 = load i32, i32* %6
%233 = add i32 %231, %232
%234 = shl i32 %233, 11
%235 = or i32 %230, %234
%236 = load i32, i32* %13
%237 = shl i32 %236, 8
%238 = or i32 %235, %237
%239 = or i32 %238, 112
%240 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %239, i32 3320)
%241 = call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
store i32 %241, i32* %14
%242 = load i32, i32* %11
%243 = shl i32 %242, 16
%244 = or i32 -2147483648, %243
%245 = load i32, i32* %12
%246 = load i32, i32* %6
%247 = add i32 %245, %246
%248 = shl i32 %247, 11
%249 = or i32 %244, %248
%250 = load i32, i32* %13
%251 = shl i32 %250, 8
%252 = or i32 %249, %251
%253 = or i32 %252, 132
%254 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %253, i32 3320)
%255 = call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
store i32 %255, i32* %15
%256 = load i32, i32* %11
%257 = shl i32 %256, 16
%258 = or i32 -2147483648, %257
%259 = load i32, i32* %12
%260 = load i32, i32* %6
%261 = add i32 %259, %260
%262 = shl i32 %261, 11
%263 = or i32 %258, %262
%264 = load i32, i32* %13
%265 = shl i32 %264, 8
%266 = or i32 %263, %265
%267 = or i32 %266, 136
%268 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %267, i32 3320)
%269 = call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
store i32 %269, i32* %16
%270 = load i32, i32* %11
%271 = shl i32 %270, 16
%272 = or i32 -2147483648, %271
%273 = load i32, i32* %12
%274 = load i32, i32* %6
%275 = add i32 %273, %274
%276 = shl i32 %275, 11
%277 = or i32 %272, %276
%278 = load i32, i32* %13
%279 = shl i32 %278, 8
%280 = or i32 %277, %279
%281 = or i32 %280, 140
%282 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %281, i32 3320)
%283 = call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
store i32 %283, i32* %17
%284 = load i32, i32* %14
%285 = ashr i32 %284, 4
%286 = and i32 %285, 7
store i32 %286, i32* %18
%287 = load i32, i32* %18
%288 = icmp ne i32 %287, 0
br i1 %288, label %289, label %292
289: ; preds = %227
%290 = load i32, i32* %18
%291 = add nsw i32 %290, 4
store i32 %291, i32* %18
br label %292
292: ; preds = %289, %227
%293 = load i32, i32* %16
%294 = and i32 %293, 7680
%295 = ashr i32 %294, 9
store i32 %295, i32* %19
%296 = load i32, i32* %16
%297 = and i32 %296, 15
store i32 %297, i32* %20
%298 = load i32, i32* %16
%299 = and i32 %298, 496
%300 = ashr i32 %299, 4
store i32 %300, i32* %21
%301 = load i32, i32* %15
%302 = and i32 %301, 448
%303 = ashr i32 %302, 6
store i32 %303, i32* %22
%304 = load i32, i32* %17
%305 = and i32 %304, 511
store i32 %305, i32* %23
%306 = load i32, i32* %14
%307 = ashr i32 %306, 9
%308 = and i32 %307, 7
store i32 %308, i32* %24
%309 = load i32, i32* %24
%310 = icmp ne i32 %309, 0
br i1 %310, label %311, label %314
311: ; preds = %292
%312 = load i32, i32* %24
%313 = add nsw i32 %312, 4
store i32 %313, i32* %24
br label %314
314: ; preds = %311, %292
%315 = load i32, i32* %16
%316 = and i32 %315, 4063232
%317 = ashr i32 %316, 17
store i32 %317, i32* %25
%318 = load i32, i32* %16
%319 = and i32 %318, 122880
%320 = ashr i32 %319, 13
store i32 %320, i32* %26
%321 = load i32, i32* %15
%322 = and i32 %321, 63
store i32 %322, i32* %27
%323 = load i32, i32* %15
%324 = and i32 %323, 2031616
%325 = ashr i32 %324, 16
store i32 %325, i32* %28
%326 = load i32, i32* %8
%327 = icmp ne i32 %326, 0
br i1 %327, label %328, label %342
328: ; preds = %314
%329 = load i32, i32* %6
%330 = load i32, i32* %18
%331 = load i32, i32* %19
%332 = load i32, i32* %20
%333 = load i32, i32* %21
%334 = load i32, i32* %22
%335 = load i32, i32* %23
%336 = load i32, i32* %24
%337 = load i32, i32* %25
%338 = load i32, i32* %26
%339 = load i32, i32* %27
%340 = load i32, i32* %28
%341 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %329, i32 %330, i32 %331, i32 %332, i32 %333, i32 %334, i32 %335, i32 %336, i32 %337, i32 %338, i32 %339, i32 %340)
br label %342
342: ; preds = %328, %314
%343 = load i32, i32* %7
%344 = icmp ne i32 %343, 0
br i1 %344, label %345, label %358
345: ; preds = %342
%346 = load i32, i32* %6
%347 = load i32, i32* %15
%348 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i32 %346, i32 %347)
%349 = load i32, i32* %6
%350 = load i32, i32* %16
%351 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 %349, i32 %350)
%352 = load i32, i32* %6
%353 = load i32, i32* %17
%354 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i32 %352, i32 %353)
%355 = load i32, i32* %6
%356 = load i32, i32* %14
%357 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.11, i64 0, i64 0), i32 %355, i32 %356)
br label %358
358: ; preds = %345, %342
br label %359
359: ; preds = %358
%360 = load i32, i32* %6
%361 = add nsw i32 %360, 1
store i32 %361, i32* %6
br label %223
362: ; preds = %223
%363 = load i32, i32* %9
%364 = icmp ne i32 %363, 0
br i1 %364, label %365, label %367
365: ; preds = %362
%366 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0))
br label %367
367: ; preds = %365, %362
%368 = call i32 (i32, ...) bitcast (i32 (...)* @iopl to i32 (i32, ...)*)(i32 0)
br label %374
369: ; preds = %173, %170
%370 = load i8**, i8*** %5
%371 = getelementptr inbounds i8*, i8** %370, i64 0
%372 = load i8*, i8** %371
%373 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), i8* %372)
br label %374
374: ; preds = %369, %367
br label %380
375: ; preds = %167
%376 = load i8**, i8*** %5
%377 = getelementptr inbounds i8*, i8** %376, i64 0
%378 = load i8*, i8** %377
%379 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([320 x i8], [320 x i8]* @.str.14, i64 0, i64 0), i8* %378)
br label %380
380: ; preds = %375, %374
%381 = load i32, i32* %10
%382 = icmp ne i32 %381, 0
%383 = xor i1 %382, true
%384 = zext i1 %383 to i64
%385 = select i1 %383, i32 0, i32 -1
ret i32 %385
}

LLVM IR (-O2):
@.str = [5 x i8] c"Zero\00"
@.str.1 = [7 x i8] c"Single\00"
@.str.2 = [5 x i8] c"Dual\00"
@.str.3 = [7 x i8] c"Triple\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
@.str.4 = [46 x i8] c"Ready to Request I/O in PCI device %x:%u.%u\0A\0A\00"
@.str.5 = [51 x i8] c"IMC %x:3.0 Memory Controler is a %s(%d) Channel.\0A\0A\00"
@.str.7 = [42 x i8] c" #%1i |%4d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d\0A\00"
@.str.8 = [46 x i8] c" |\09MC_CHANNEL_%1i_RANK_TIMING_B [0x%08x]\0A\00"
@.str.9 = [46 x i8] c" |\09MC_CHANNEL_%1i_BANK_TIMING [0x%08x]\0A\00"
@.str.10 = [46 x i8] c" |\09MC_CHANNEL_%1i_REFRESH_TIMING [0x%08x]\0A\00"
@.str.11 = [46 x i8] c" |\09MC_CHANNEL_%1i_MRS_VALUES [0x%08x]\0A\00"
@.str.13 = [20 x i8] c"%s: Must be root !\0A\00"
@.str.14 = [320 x i8] c"Usage: %s [OPTION]\0A-r / ~r print / hide raw register values\0A-t / ~t print / hide timings (default)\0A-s / ~s print / hide SPD\0A-b <num> use the specified bus id\0A-d <num> use the specified device id\0A-f <num> use the specified function number\0A-h give this help list\0A\00"
@str = [73 x i8] c"DDR tCL tRCD tRP tRAS tRRD tRFC tWR tWTPr tRTPr tFAW B2B \00"
@str.15 = [28 x i8] c"\0ASPD: not implemented yet !\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %67
4: ; preds = %2, %54
%5 = phi i32 [ %62, %54 ], [ 0, %2 ]
%6 = phi i32 [ %61, %54 ], [ 4, %2 ]
%7 = phi i32 [ %60, %54 ], [ 255, %2 ]
%8 = phi i32 [ %59, %54 ], [ 0, %2 ]
%9 = phi i32 [ %58, %54 ], [ 0, %2 ]
%10 = phi i32 [ %57, %54 ], [ 1, %2 ]
%11 = phi i32 [ %56, %54 ], [ 0, %2 ]
%12 = phi i32 [ %63, %54 ], [ 1, %2 ]
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
switch i8 %16, label %54 [
i8 45, label %17
i8 126, label %17
]
17: ; preds = %4, %4
%18 = getelementptr inbounds i8, i8* %15, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %54 [
i32 98, label %21
i32 100, label %29
i32 102, label %37
i32 114, label %45
i32 116, label %48
i32 115, label %51
]
21: ; preds = %17
%22 = add nsw i32 %12, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
%25 = load i8*, i8** %24
%26 = icmp eq i8* %25, null
br i1 %26, label %54, label %27
27: ; preds = %21
%28 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %25)
br label %54
29: ; preds = %17
%30 = add nsw i32 %12, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = icmp eq i8* %33, null
br i1 %34, label %54, label %35
35: ; preds = %29
%36 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %33)
br label %54
37: ; preds = %17
%38 = add nsw i32 %12, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %1, i64 %39
%41 = load i8*, i8** %40
%42 = icmp eq i8* %41, null
br i1 %42, label %54, label %43
43: ; preds = %37
%44 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %41)
br label %54
45: ; preds = %17
%46 = icmp ne i8 %16, 126
%47 = zext i1 %46 to i32
br label %54
48: ; preds = %17
%49 = icmp ne i8 %16, 126
%50 = zext i1 %49 to i32
br label %54
51: ; preds = %17
%52 = icmp ne i8 %16, 126
%53 = zext i1 %52 to i32
br label %54
54: ; preds = %4, %17, %37, %29, %21, %43, %35, %27, %51, %48, %45
%55 = phi i32 [ %12, %51 ], [ %12, %48 ], [ %12, %45 ], [ %38, %43 ], [ %30, %35 ], [ %22, %27 ], [ %12, %21 ], [ %12, %29 ], [ %12, %37 ], [ %12, %17 ], [ %12, %4 ]
%56 = phi i32 [ %11, %51 ], [ %11, %48 ], [ %47, %45 ], [ %11, %43 ], [ %11, %35 ], [ %11, %27 ], [ %11, %21 ], [ %11, %29 ], [ %11, %37 ], [ %11, %17 ], [ %11, %4 ]
%57 = phi i32 [ %10, %51 ], [ %50, %48 ], [ %10, %45 ], [ %10, %43 ], [ %10, %35 ], [ %10, %27 ], [ %10, %21 ], [ %10, %29 ], [ %10, %37 ], [ %10, %17 ], [ %10, %4 ]
%58 = phi i32 [ %53, %51 ], [ %9, %48 ], [ %9, %45 ], [ %9, %43 ], [ %9, %35 ], [ %9, %27 ], [ %9, %21 ], [ %9, %29 ], [ %9, %37 ], [ %9, %17 ], [ %9, %4 ]
%59 = phi i32 [ %8, %51 ], [ %8, %48 ], [ %8, %45 ], [ %8, %43 ], [ %8, %35 ], [ %8, %27 ], [ 1, %21 ], [ 1, %29 ], [ 1, %37 ], [ 1, %17 ], [ 1, %4 ]
%60 = phi i32 [ %7, %51 ], [ %7, %48 ], [ %7, %45 ], [ %7, %43 ], [ %7, %35 ], [ %28, %27 ], [ %7, %21 ], [ %7, %29 ], [ %7, %37 ], [ %7, %17 ], [ %7, %4 ]
%61 = phi i32 [ %6, %51 ], [ %6, %48 ], [ %6, %45 ], [ %6, %43 ], [ %36, %35 ], [ %6, %27 ], [ %6, %21 ], [ %6, %29 ], [ %6, %37 ], [ %6, %17 ], [ %6, %4 ]
%62 = phi i32 [ %5, %51 ], [ %5, %48 ], [ %5, %45 ], [ %44, %43 ], [ %5, %35 ], [ %5, %27 ], [ %5, %21 ], [ %5, %29 ], [ %5, %37 ], [ %5, %17 ], [ %5, %4 ]
%63 = add nsw i32 %55, 1
%64 = icmp slt i32 %63, %0
br i1 %64, label %4, label %65
65: ; preds = %54
%66 = icmp eq i32 %59, 0
br i1 %66, label %67, label %164
67: ; preds = %2, %65
%68 = phi i32 [ %62, %65 ], [ 0, %2 ]
%69 = phi i32 [ %61, %65 ], [ 4, %2 ]
%70 = phi i32 [ %60, %65 ], [ 255, %2 ]
%71 = phi i32 [ %58, %65 ], [ 0, %2 ]
%72 = phi i32 [ %57, %65 ], [ 1, %2 ]
%73 = phi i32 [ %56, %65 ], [ 0, %2 ]
%74 = tail call i32 (...) @geteuid()
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %161
76: ; preds = %67
%77 = tail call i32 (i32, ...) bitcast (i32 (...)* @iopl to i32 (i32, ...)*)(i32 3)
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %161
79: ; preds = %76
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i32 %70, i32 %69, i32 %68)
%81 = shl i32 %70, 16
%82 = or i32 %81, -2147477432
%83 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %82, i32 3320)
%84 = tail call i32 (i32, ...) bitcast (i32 (...)* @inw to i32 (i32, ...)*)(i32 3324)
%85 = lshr i32 %84, 8
%86 = and i32 %85, 7
switch i32 %86, label %87 [
i32 7, label %91
i32 4, label %90
i32 2, label %90
]
87: ; preds = %79
%88 = icmp eq i32 %86, 1
%89 = select i1 %88, i32 1, i32 2
br label %91
90: ; preds = %79, %79
br label %91
91: ; preds = %79, %90, %87
%92 = phi i32 [ 3, %79 ], [ %89, %87 ], [ 1, %90 ]
%93 = zext i32 %92 to i64
%94 = shl i64 %93, 2
%95 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %94)
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i32 %70, i8* %95, i32 %86)
%97 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
%98 = shl i32 %68, 8
%99 = or i32 %81, %98
%100 = icmp eq i32 %72, 0
%101 = icmp eq i32 %73, 0
br label %102
102: ; preds = %91, %152
%103 = phi i32 [ 0, %91 ], [ %153, %152 ]
%104 = add i32 %103, %69
%105 = shl i32 %104, 11
%106 = or i32 %99, %105
%107 = or i32 %106, -2147483536
%108 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %107, i32 3320)
%109 = tail call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
%110 = or i32 %106, -2147483516
%111 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %110, i32 3320)
%112 = tail call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
%113 = or i32 %106, -2147483512
%114 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %113, i32 3320)
%115 = tail call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
%116 = or i32 %106, -2147483508
%117 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outl to i32 (i32, i32, ...)*)(i32 %116, i32 3320)
%118 = tail call i32 (i32, ...) bitcast (i32 (...)* @inl to i32 (i32, ...)*)(i32 3324)
%119 = lshr i32 %109, 4
%120 = and i32 %119, 7
%121 = lshr i32 %109, 9
%122 = and i32 %121, 7
br i1 %100, label %146, label %123
123: ; preds = %102
%124 = icmp eq i32 %122, 0
%125 = add nuw nsw i32 %122, 4
%126 = select i1 %124, i32 0, i32 %125
%127 = and i32 %118, 511
%128 = lshr i32 %112, 6
%129 = and i32 %128, 7
%130 = lshr i32 %115, 4
%131 = and i32 %130, 31
%132 = and i32 %115, 15
%133 = lshr i32 %115, 9
%134 = and i32 %133, 15
%135 = icmp eq i32 %120, 0
%136 = add nuw nsw i32 %120, 4
%137 = select i1 %135, i32 0, i32 %136
%138 = lshr i32 %112, 16
%139 = and i32 %138, 31
%140 = and i32 %112, 63
%141 = lshr i32 %115, 13
%142 = and i32 %141, 15
%143 = lshr i32 %115, 17
%144 = and i32 %143, 31
%145 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %103, i32 %137, i32 %134, i32 %132, i32 %131, i32 %129, i32 %127, i32 %126, i32 %144, i32 %142, i32 %140, i32 %139)
br label %146
146: ; preds = %123, %102
br i1 %101, label %152, label %147
147: ; preds = %146
%148 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), i32 %103, i32 %112)
%149 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 %103, i32 %115)
%150 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i32 %103, i32 %118)
%151 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.11, i64 0, i64 0), i32 %103, i32 %109)
br label %152
152: ; preds = %146, %147
%153 = add nuw nsw i32 %103, 1
%154 = icmp eq i32 %153, %92
br i1 %154, label %155, label %102
155: ; preds = %152
%156 = icmp eq i32 %71, 0
br i1 %156, label %159, label %157
157: ; preds = %155
%158 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.15, i64 0, i64 0))
br label %159
159: ; preds = %157, %155
%160 = tail call i32 (i32, ...) bitcast (i32 (...)* @iopl to i32 (i32, ...)*)(i32 0)
br label %167
161: ; preds = %76, %67
%162 = load i8*, i8** %1
%163 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), i8* %162)
br label %167
164: ; preds = %65
%165 = load i8*, i8** %1
%166 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([320 x i8], [320 x i8]* @.str.14, i64 0, i64 0), i8* %165)
br label %167
167: ; preds = %159, %161, %164
%168 = phi i32 [ 0, %159 ], [ 0, %161 ], [ -1, %164 ]
ret i32 %168
}