int do_amd(void) {
  kprint("AMD Specific Features:\n");
  unsigned long extended, eax, ebx, ecx, edx, unused;
  int family, model, stepping, reserved;
  __asm__("cpuid"
          : "=a"(eax), "=b"(unused), "=c"(unused), "=d"(unused)
          : "a"(1));
  ;
  model = (eax >> 4) & 0xf;
  family = (eax >> 8) & 0xf;
  stepping = eax & 0xf;
  reserved = eax >> 12;
  kprint("Family: ");
  kpi(family);
  kps(" Model: ");
  kpi(model);
  kps(" [");
  switch (family) {
  case 4:
    kprint("486 Model ");
    kpi(model);
    break;
  case 5:
    switch (model) {
    case 0:
    case 1:
    case 2:
    case 3:
    case 6:
    case 7:
      kprint("K6 Model ");
      kpi(model);
      break;
    case 8:
      kprint("K6-2 Model 8");
      break;
    case 9:
      kprint("K6-III Model 9");
      break;
    default:
      kprint("K5/K6 Model ");
      kpi(model);
      break;
    }
    break;
  case 6:
    switch (model) {
    case 1:
    case 2:
    case 4:
      kprint("Athlon Model ");
      kpi(model);
      break;
    case 3:
      kprint("Duron Model 3");
      break;
    case 6:
      kprint("Athlon MP/Mobile Athlon Model 6");
      break;
    case 7:
      kprint("Mobile Duron Model 7");
      break;
    default:
      kprint("Duron/Athlon Model ");
      kpi(model);
      break;
    }
    break;
  }
  kprint("]\n");
  __asm__("cpuid"
          : "=a"(extended), "=b"(unused), "=c"(unused), "=d"(unused)
          : "a"(0x80000000));
  ;
  if (extended == 0) {
    return 0;
  }
  if (extended >= 0x80000002) {
    unsigned int j;
    kprint("Detected Processor Name: ");
    for (j = 0x80000002; j <= 0x80000004; j++) {
      __asm__("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(j));
      ;
      printregs(eax, ebx, ecx, edx);
    }
    kprint("\n");
  }
  if (extended >= 0x80000007) {
    __asm__("cpuid"
            : "=a"(unused), "=b"(unused), "=c"(unused), "=d"(edx)
            : "a"(0x80000007));
    ;
    if (edx & 1) {
      kprint("Temperature Sensing Diode Detected!\n");
    }
  }
  kprint("Stepping: ");
  kpi(stepping);
  kps(" Reserved: ");
  kpi(reserved);
  kps("\n");
  return 0;
}


x86 assembly (clang, -O0):
<do_amd>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
lea    0xecc(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x59(%rbp)
call   1060 <kprint@plt>
mov    $0x1,%eax
cpuid
mov    %rax,%rsi
mov    -0x59(%rbp),%al
mov    %rsi,-0x20(%rbp)
mov    %rbx,-0x40(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %rdx,-0x40(%rbp)
mov    -0x20(%rbp),%ecx
shr    $0x4,%ecx
and    $0xf,%ecx
mov    %ecx,-0x48(%rbp)
mov    -0x20(%rbp),%ecx
shr    $0x8,%ecx
and    $0xf,%ecx
mov    %ecx,-0x44(%rbp)
mov    -0x20(%rbp),%ecx
and    $0xf,%ecx
mov    %ecx,-0x4c(%rbp)
mov    -0x20(%rbp),%rcx
shr    $0xc,%rcx
mov    %ecx,-0x50(%rbp)
lea    0xe8a(%rip),%rdi
call   1060 <kprint@plt>
mov    -0x59(%rbp),%al
mov    -0x44(%rbp),%edi
call   1030 <kpi@plt>
mov    -0x59(%rbp),%al
lea    0xe79(%rip),%rdi
call   1040 <kps@plt>
mov    -0x59(%rbp),%al
mov    -0x48(%rbp),%edi
call   1030 <kpi@plt>
mov    -0x59(%rbp),%al
lea    0xe68(%rip),%rdi
call   1040 <kps@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x58(%rbp)
sub    $0x4,%eax
je     1219 <do_amd+0xd9>
jmp    11f7 <do_amd+0xb7>
mov    -0x58(%rbp),%eax
sub    $0x5,%eax
je     1236 <do_amd+0xf6>
jmp    1208 <do_amd+0xc8>
mov    -0x58(%rbp),%eax
sub    $0x6,%eax
je     12e0 <do_amd+0x1a0>
jmp    137c <do_amd+0x23c>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    -0x48(%rbp),%edi
mov    $0x0,%al
call   1030 <kpi@plt>
jmp    137c <do_amd+0x23c>
mov    -0x48(%rbp),%eax
mov    %eax,-0x60(%rbp)
sub    $0x4,%eax
jb     1280 <do_amd+0x140>
jmp    124a <do_amd+0x10a>
mov    -0x60(%rbp),%eax
add    $0xfffffffa,%eax
sub    $0x2,%eax
jb     1280 <do_amd+0x140>
jmp    125e <do_amd+0x11e>
mov    -0x60(%rbp),%eax
sub    $0x8,%eax
je     129d <do_amd+0x15d>
jmp    126f <do_amd+0x12f>
mov    -0x60(%rbp),%eax
sub    $0x9,%eax
je     12b0 <do_amd+0x170>
jmp    12c3 <do_amd+0x183>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    -0x48(%rbp),%edi
mov    $0x0,%al
call   1030 <kpi@plt>
jmp    12db <do_amd+0x19b>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
jmp    12db <do_amd+0x19b>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
jmp    12db <do_amd+0x19b>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    -0x48(%rbp),%edi
mov    $0x0,%al
call   1030 <kpi@plt>
jmp    137c <do_amd+0x23c>
mov    -0x48(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x68(%rbp)
sub    $0x6,%eax
ja     135f <do_amd+0x21f>
mov    -0x68(%rbp),%rax
lea    0xd00(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    -0x48(%rbp),%edi
mov    $0x0,%al
call   1030 <kpi@plt>
jmp    1377 <do_amd+0x237>
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
jmp    1377 <do_amd+0x237>
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
jmp    1377 <do_amd+0x237>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
jmp    1377 <do_amd+0x237>
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    -0x48(%rbp),%edi
mov    $0x0,%al
call   1030 <kpi@plt>
jmp    137c <do_amd+0x23c>
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    $0x80000000,%eax
cpuid
mov    %rax,-0x18(%rbp)
mov    %rbx,-0x40(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %rdx,-0x40(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13b8 <do_amd+0x278>
movl   $0x0,-0xc(%rbp)
jmp    14c1 <do_amd+0x381>
mov    $0x80000002,%eax
cmp    %rax,-0x18(%rbp)
jb     1431 <do_amd+0x2f1>
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
movl   $0x80000002,-0x54(%rbp)
cmpl   $0x80000004,-0x54(%rbp)
ja     1423 <do_amd+0x2e3>
mov    -0x54(%rbp),%eax
cpuid
mov    %rax,-0x20(%rbp)
mov    %rbx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    $0x0,%al
call   1050 <printregs@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    13dc <do_amd+0x29c>
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    $0x80000007,%eax
cmp    %rax,-0x18(%rbp)
jb     147c <do_amd+0x33c>
mov    $0x80000007,%eax
cpuid
mov    %rax,-0x40(%rbp)
mov    %rbx,-0x40(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %rdx,-0x38(%rbp)
mov    -0x38(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1477 <do_amd+0x337>
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
jmp    147c <do_amd+0x33c>
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1060 <kprint@plt>
mov    -0x4c(%rbp),%edi
mov    $0x0,%al
call   1030 <kpi@plt>
lea    0xc86(%rip),%rdi
mov    $0x0,%al
call   1040 <kps@plt>
mov    -0x50(%rbp),%edi
mov    $0x0,%al
call   1030 <kpi@plt>
lea    0xc61(%rip),%rdi
mov    $0x0,%al
call   1040 <kps@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_amd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
mov    $0x1,%eax
cpuid
mov    %rax,%r14
mov    %r14d,%ebx
shr    $0x4,%ebx
and    $0xf,%ebx
mov    %r14d,%ebp
shr    $0x8,%ebp
and    $0xf,%ebp
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <kpi@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1040 <kps@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <kpi@plt>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1040 <kps@plt>
cmp    $0x6,%ebp
je     11cd <do_amd+0x8d>
cmp    $0x5,%ebp
je     11ee <do_amd+0xae>
cmp    $0x4,%ebp
jne    1263 <do_amd+0x123>
lea    0xe7e(%rip),%rdi
jmp    1208 <do_amd+0xc8>
lea    -0x1(%rbx),%eax
cmp    $0x6,%eax
ja     123a <do_amd+0xfa>
lea    0xe24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeda(%rip),%rdi
jmp    1208 <do_amd+0xc8>
cmp    $0x9,%ebx
ja     1389 <do_amd+0x249>
mov    $0xcf,%eax
bt     %ebx,%eax
jae    121a <do_amd+0xda>
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <kpi@plt>
jmp    1263 <do_amd+0x123>
cmp    $0x8,%ebx
je     1255 <do_amd+0x115>
cmp    $0x9,%ebx
jne    1389 <do_amd+0x249>
lea    0xe32(%rip),%rdi
jmp    125c <do_amd+0x11c>
lea    0xe45(%rip),%rdi
jmp    125c <do_amd+0x11c>
lea    0xe7f(%rip),%rdi
jmp    1208 <do_amd+0xc8>
lea    0xe41(%rip),%rdi
jmp    125c <do_amd+0x11c>
lea    0xe58(%rip),%rdi
jmp    125c <do_amd+0x11c>
lea    0xdf8(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
mov    $0x80000000,%eax
cpuid
test   %rax,%rax
je     1378 <do_amd+0x238>
mov    %rax,%r12
mov    %r14,%r15
shr    $0xc,%r15
and    $0xf,%r14d
shr    %rax
cmp    $0x40000001,%rax
jb     133a <do_amd+0x1fa>
mov    $0x80000001,%r13d
lea    0xe2c(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
mov    $0x80000002,%eax
cpuid
mov    %rdx,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rcx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <printregs@plt>
mov    $0x80000003,%eax
cpuid
mov    %rdx,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rcx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <printregs@plt>
mov    $0x80000004,%eax
cpuid
mov    %rdx,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rcx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <printregs@plt>
lea    0xe04(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
add    $0x5,%r13
cmp    %r13,%r12
jbe    133a <do_amd+0x1fa>
mov    $0x80000007,%eax
cpuid
test   $0x1,%dl
je     133a <do_amd+0x1fa>
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
lea    0xdd5(%rip),%rdi
xor    %eax,%eax
call   1060 <kprint@plt>
mov    %r14d,%edi
xor    %eax,%eax
call   1030 <kpi@plt>
lea    0xdc8(%rip),%rdi
xor    %eax,%eax
call   1040 <kps@plt>
mov    %r15d,%edi
xor    %eax,%eax
call   1030 <kpi@plt>
lea    0xda3(%rip),%rdi
xor    %eax,%eax
call   1040 <kps@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xce0(%rip),%rdi
jmp    1208 <do_amd+0xc8>

LLVM IR (-O0):
@.str = [24 x i8] c"AMD Specific Features:\0A\00"
@.str.1 = [9 x i8] c"Family: \00"
@.str.2 = [9 x i8] c" Model: \00"
@.str.3 = [3 x i8] c" [\00"
@.str.4 = [11 x i8] c"486 Model \00"
@.str.5 = [10 x i8] c"K6 Model \00"
@.str.6 = [13 x i8] c"K6-2 Model 8\00"
@.str.7 = [15 x i8] c"K6-III Model 9\00"
@.str.8 = [13 x i8] c"K5/K6 Model \00"
@.str.9 = [14 x i8] c"Athlon Model \00"
@.str.10 = [14 x i8] c"Duron Model 3\00"
@.str.11 = [32 x i8] c"Athlon MP/Mobile Athlon Model 6\00"
@.str.12 = [21 x i8] c"Mobile Duron Model 7\00"
@.str.13 = [20 x i8] c"Duron/Athlon Model \00"
@.str.14 = [3 x i8] c"]\0A\00"
@.str.15 = [26 x i8] c"Detected Processor Name: \00"
@.str.16 = [2 x i8] c"\0A\00"
@.str.17 = [37 x i8] c"Temperature Sensing Diode Detected!\0A\00"
@.str.18 = [11 x i8] c"Stepping: \00"
@.str.19 = [12 x i8] c" Reserved: \00"
define i32 @do_amd() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%14 = call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 1)
%15 = extractvalue { i64, i64, i64, i64 } %14, 0
%16 = extractvalue { i64, i64, i64, i64 } %14, 1
%17 = extractvalue { i64, i64, i64, i64 } %14, 2
%18 = extractvalue { i64, i64, i64, i64 } %14, 3
store i64 %15, i64* %3
store i64 %16, i64* %7
store i64 %17, i64* %7
store i64 %18, i64* %7
%19 = load i64, i64* %3
%20 = lshr i64 %19, 4
%21 = and i64 %20, 15
%22 = trunc i64 %21 to i32
store i32 %22, i32* %9
%23 = load i64, i64* %3
%24 = lshr i64 %23, 8
%25 = and i64 %24, 15
%26 = trunc i64 %25 to i32
store i32 %26, i32* %8
%27 = load i64, i64* %3
%28 = and i64 %27, 15
%29 = trunc i64 %28 to i32
store i32 %29, i32* %10
%30 = load i64, i64* %3
%31 = lshr i64 %30, 12
%32 = trunc i64 %31 to i32
store i32 %32, i32* %11
%33 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%34 = load i32, i32* %8
%35 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %34)
%36 = call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%37 = load i32, i32* %9
%38 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %37)
%39 = call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* %8
switch i32 %40, label %77 [
i32 4, label %41
i32 5, label %45
i32 6, label %60
]
41: ; preds = %0
%42 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%43 = load i32, i32* %9
%44 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %43)
br label %77
45: ; preds = %0
%46 = load i32, i32* %9
switch i32 %46, label %55 [
i32 0, label %47
i32 1, label %47
i32 2, label %47
i32 3, label %47
i32 6, label %47
i32 7, label %47
i32 8, label %51
i32 9, label %53
]
47: ; preds = %45, %45, %45, %45, %45, %45
%48 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%49 = load i32, i32* %9
%50 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %49)
br label %59
51: ; preds = %45
%52 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %59
53: ; preds = %45
%54 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %59
55: ; preds = %45
%56 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%57 = load i32, i32* %9
%58 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %57)
br label %59
59: ; preds = %55, %53, %51, %47
br label %77
60: ; preds = %0
%61 = load i32, i32* %9
switch i32 %61, label %72 [
i32 1, label %62
i32 2, label %62
i32 4, label %62
i32 3, label %66
i32 6, label %68
i32 7, label %70
]
62: ; preds = %60, %60, %60
%63 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%64 = load i32, i32* %9
%65 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %64)
br label %76
66: ; preds = %60
%67 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %76
68: ; preds = %60
%69 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
br label %76
70: ; preds = %60
%71 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
br label %76
72: ; preds = %60
%73 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
%74 = load i32, i32* %9
%75 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %74)
br label %76
76: ; preds = %72, %70, %68, %66, %62
br label %77
77: ; preds = %0, %76, %59, %41
%78 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%79 = call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 -2147483648)
%80 = extractvalue { i64, i64, i64, i64 } %79, 0
%81 = extractvalue { i64, i64, i64, i64 } %79, 1
%82 = extractvalue { i64, i64, i64, i64 } %79, 2
%83 = extractvalue { i64, i64, i64, i64 } %79, 3
store i64 %80, i64* %2
store i64 %81, i64* %7
store i64 %82, i64* %7
store i64 %83, i64* %7
%84 = load i64, i64* %2
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %77
store i32 0, i32* %1
br label %135
87: ; preds = %77
%88 = load i64, i64* %2
%89 = icmp uge i64 %88, 2147483650
br i1 %89, label %90, label %112
90: ; preds = %87
%91 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0))
store i32 -2147483646, i32* %12
br label %92
92: ; preds = %107, %90
%93 = load i32, i32* %12
%94 = icmp ule i32 %93, -2147483644
br i1 %94, label %95, label %110
95: ; preds = %92
%96 = load i32, i32* %12
%97 = call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %96)
%98 = extractvalue { i64, i64, i64, i64 } %97, 0
%99 = extractvalue { i64, i64, i64, i64 } %97, 1
%100 = extractvalue { i64, i64, i64, i64 } %97, 2
%101 = extractvalue { i64, i64, i64, i64 } %97, 3
store i64 %98, i64* %3
store i64 %99, i64* %4
store i64 %100, i64* %5
store i64 %101, i64* %6
%102 = load i64, i64* %3
%103 = load i64, i64* %4
%104 = load i64, i64* %5
%105 = load i64, i64* %6
%106 = call i32 (i64, i64, i64, i64, ...) bitcast (i32 (...)* @printregs to i32 (i64, i64, i64, i64, ...)*)(i64 %102, i64 %103, i64 %104, i64 %105)
br label %107
107: ; preds = %95
%108 = load i32, i32* %12
%109 = add i32 %108, 1
store i32 %109, i32* %12
br label %92
110: ; preds = %92
%111 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
br label %112
112: ; preds = %110, %87
%113 = load i64, i64* %2
%114 = icmp uge i64 %113, 2147483655
br i1 %114, label %115, label %127
115: ; preds = %112
%116 = call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 -2147483641)
%117 = extractvalue { i64, i64, i64, i64 } %116, 0
%118 = extractvalue { i64, i64, i64, i64 } %116, 1
%119 = extractvalue { i64, i64, i64, i64 } %116, 2
%120 = extractvalue { i64, i64, i64, i64 } %116, 3
store i64 %117, i64* %7
store i64 %118, i64* %7
store i64 %119, i64* %7
store i64 %120, i64* %6
%121 = load i64, i64* %6
%122 = and i64 %121, 1
%123 = icmp ne i64 %122, 0
br i1 %123, label %124, label %126
124: ; preds = %115
%125 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.17, i64 0, i64 0))
br label %126
126: ; preds = %124, %115
br label %127
127: ; preds = %126, %112
%128 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
%129 = load i32, i32* %10
%130 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %129)
%131 = call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0))
%132 = load i32, i32* %11
%133 = call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %132)
%134 = call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
store i32 0, i32* %1
br label %135
135: ; preds = %127, %86
%136 = load i32, i32* %1
ret i32 %136
}

LLVM IR (-O2):
@.str = [24 x i8] c"AMD Specific Features:\0A\00"
@.str.1 = [9 x i8] c"Family: \00"
@.str.2 = [9 x i8] c" Model: \00"
@.str.3 = [3 x i8] c" [\00"
@.str.4 = [11 x i8] c"486 Model \00"
@.str.5 = [10 x i8] c"K6 Model \00"
@.str.6 = [13 x i8] c"K6-2 Model 8\00"
@.str.7 = [15 x i8] c"K6-III Model 9\00"
@.str.8 = [13 x i8] c"K5/K6 Model \00"
@.str.9 = [14 x i8] c"Athlon Model \00"
@.str.10 = [14 x i8] c"Duron Model 3\00"
@.str.11 = [32 x i8] c"Athlon MP/Mobile Athlon Model 6\00"
@.str.12 = [21 x i8] c"Mobile Duron Model 7\00"
@.str.13 = [20 x i8] c"Duron/Athlon Model \00"
@.str.14 = [3 x i8] c"]\0A\00"
@.str.15 = [26 x i8] c"Detected Processor Name: \00"
@.str.16 = [2 x i8] c"\0A\00"
@.str.17 = [37 x i8] c"Temperature Sensing Diode Detected!\0A\00"
@.str.18 = [11 x i8] c"Stepping: \00"
@.str.19 = [12 x i8] c" Reserved: \00"
define i32 @do_amd() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = tail call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 1)
%3 = extractvalue { i64, i64, i64, i64 } %2, 0
%4 = trunc i64 %3 to i32
%5 = lshr i32 %4, 4
%6 = and i32 %5, 15
%7 = lshr i32 %4, 8
%8 = and i32 %7, 15
%9 = and i32 %4, 15
%10 = lshr i64 %3, 12
%11 = trunc i64 %10 to i32
%12 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %8)
%14 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %6)
%16 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
switch i32 %8, label %44 [
i32 4, label %17
i32 5, label %20
i32 6, label %31
]
17: ; preds = %0
%18 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %6)
br label %44
20: ; preds = %0
switch i32 %6, label %28 [
i32 0, label %21
i32 1, label %21
i32 2, label %21
i32 3, label %21
i32 6, label %21
i32 7, label %21
i32 8, label %24
i32 9, label %26
]
21: ; preds = %20, %20, %20, %20, %20, %20
%22 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%23 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %6)
br label %44
24: ; preds = %20
%25 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %44
26: ; preds = %20
%27 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %44
28: ; preds = %20
%29 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%30 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %6)
br label %44
31: ; preds = %0
switch i32 %6, label %41 [
i32 1, label %32
i32 2, label %32
i32 4, label %32
i32 3, label %35
i32 6, label %37
i32 7, label %39
]
32: ; preds = %31, %31, %31
%33 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%34 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %6)
br label %44
35: ; preds = %31
%36 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %44
37: ; preds = %31
%38 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
br label %44
39: ; preds = %31
%40 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
br label %44
41: ; preds = %31
%42 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
%43 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %6)
br label %44
44: ; preds = %32, %35, %37, %39, %41, %21, %24, %26, %28, %0, %17
%45 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%46 = tail call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 -2147483648)
%47 = extractvalue { i64, i64, i64, i64 } %46, 0
%48 = icmp eq i64 %47, 0
br i1 %48, label %86, label %49
49: ; preds = %44
%50 = icmp ugt i64 %47, 2147483649
br i1 %50, label %51, label %80
51: ; preds = %49
%52 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0))
%53 = tail call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 -2147483646)
%54 = extractvalue { i64, i64, i64, i64 } %53, 0
%55 = extractvalue { i64, i64, i64, i64 } %53, 1
%56 = extractvalue { i64, i64, i64, i64 } %53, 2
%57 = extractvalue { i64, i64, i64, i64 } %53, 3
%58 = tail call i32 (i64, i64, i64, i64, ...) bitcast (i32 (...)* @printregs to i32 (i64, i64, i64, i64, ...)*)(i64 %54, i64 %55, i64 %56, i64 %57)
%59 = tail call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 -2147483645)
%60 = extractvalue { i64, i64, i64, i64 } %59, 0
%61 = extractvalue { i64, i64, i64, i64 } %59, 1
%62 = extractvalue { i64, i64, i64, i64 } %59, 2
%63 = extractvalue { i64, i64, i64, i64 } %59, 3
%64 = tail call i32 (i64, i64, i64, i64, ...) bitcast (i32 (...)* @printregs to i32 (i64, i64, i64, i64, ...)*)(i64 %60, i64 %61, i64 %62, i64 %63)
%65 = tail call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 -2147483644)
%66 = extractvalue { i64, i64, i64, i64 } %65, 0
%67 = extractvalue { i64, i64, i64, i64 } %65, 1
%68 = extractvalue { i64, i64, i64, i64 } %65, 2
%69 = extractvalue { i64, i64, i64, i64 } %65, 3
%70 = tail call i32 (i64, i64, i64, i64, ...) bitcast (i32 (...)* @printregs to i32 (i64, i64, i64, i64, ...)*)(i64 %66, i64 %67, i64 %68, i64 %69)
%71 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%72 = icmp ugt i64 %47, 2147483654
br i1 %72, label %73, label %80
73: ; preds = %51
%74 = tail call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 -2147483641)
%75 = extractvalue { i64, i64, i64, i64 } %74, 3
%76 = and i64 %75, 1
%77 = icmp eq i64 %76, 0
br i1 %77, label %80, label %78
78: ; preds = %73
%79 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.17, i64 0, i64 0))
br label %80
80: ; preds = %49, %73, %78, %51
%81 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
%82 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %9)
%83 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0))
%84 = tail call i32 (i32, ...) bitcast (i32 (...)* @kpi to i32 (i32, ...)*)(i32 %11)
%85 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kps to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
br label %86
86: ; preds = %44, %80
ret i32 0
}