int do_amd(void) {
  printf("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;
  printf("Family: %d Model: %d [", family, model);
  switch (family) {
  case 4:
    printf("486 Model %d", model);
    break;
  case 5:
    switch (model) {
    case 0:
    case 1:
    case 2:
    case 3:
    case 6:
    case 7:
      printf("K6 Model %d", model);
      break;
    case 8:
      printf("K6-2 Model 8");
      break;
    case 9:
      printf("K6-III Model 9");
      break;
    default:
      printf("K5/K6 Model %d", model);
      break;
    }
    break;
  case 6:
    switch (model) {
    case 1:
    case 2:
    case 4:
      printf("Athlon Model %d", model);
      break;
    case 3:
      printf("Duron Model 3");
      break;
    case 6:
      printf("Athlon MP/Mobile Athlon Model 6");
      break;
    case 7:
      printf("Mobile Duron Model 7");
      break;
    default:
      printf("Duron/Athlon Model %d", model);
      break;
    }
    break;
  }
  printf("]\n");
  __asm__("cpuid"
          : "=a"(extended), "=b"(unused), "=c"(unused), "=d"(unused)
          : "a"(0x80000000));
  ;
  if (extended == 0) {
    return 0;
  }
  if (extended >= 0x80000002) {
    unsigned int j;
    printf("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);
    }
    printf("\n");
  }
  if (extended >= 0x80000007) {
    __asm__("cpuid"
            : "=a"(unused), "=b"(unused), "=c"(unused), "=d"(edx)
            : "a"(0x80000007));
    ;
    if (edx & 1) {
      printf("Temperature Sensing Diode Detected!\n");
    }
  }
  printf("Stepping: %d Reserved: %d\n", stepping, reserved);
  return 0;
}


x86 assembly (clang, -O0):
<do_amd>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
lea    0xeec(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x59(%rbp)
call   1030 <printf@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)
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x58(%rbp)
sub    $0x4,%eax
je     11cb <do_amd+0xab>
jmp    11a9 <do_amd+0x89>
mov    -0x58(%rbp),%eax
sub    $0x5,%eax
je     11e1 <do_amd+0xc1>
jmp    11ba <do_amd+0x9a>
mov    -0x58(%rbp),%eax
sub    $0x6,%eax
je     127d <do_amd+0x15d>
jmp    130b <do_amd+0x1eb>
mov    -0x48(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130b <do_amd+0x1eb>
mov    -0x48(%rbp),%eax
mov    %eax,-0x60(%rbp)
sub    $0x4,%eax
jb     122b <do_amd+0x10b>
jmp    11f5 <do_amd+0xd5>
mov    -0x60(%rbp),%eax
add    $0xfffffffa,%eax
sub    $0x2,%eax
jb     122b <do_amd+0x10b>
jmp    1209 <do_amd+0xe9>
mov    -0x60(%rbp),%eax
sub    $0x8,%eax
je     1241 <do_amd+0x121>
jmp    121a <do_amd+0xfa>
mov    -0x60(%rbp),%eax
sub    $0x9,%eax
je     1254 <do_amd+0x134>
jmp    1267 <do_amd+0x147>
mov    -0x48(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1278 <do_amd+0x158>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1278 <do_amd+0x158>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1278 <do_amd+0x158>
mov    -0x48(%rbp),%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130b <do_amd+0x1eb>
mov    -0x48(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x68(%rbp)
sub    $0x6,%eax
ja     12f5 <do_amd+0x1d5>
mov    -0x68(%rbp),%rax
lea    0xd63(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x48(%rbp),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1306 <do_amd+0x1e6>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1306 <do_amd+0x1e6>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1306 <do_amd+0x1e6>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1306 <do_amd+0x1e6>
mov    -0x48(%rbp),%esi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130b <do_amd+0x1eb>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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    1347 <do_amd+0x227>
movl   $0x0,-0xc(%rbp)
jmp    1426 <do_amd+0x306>
mov    $0x80000002,%eax
cmp    %rax,-0x18(%rbp)
jb     13c0 <do_amd+0x2a0>
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x80000002,-0x54(%rbp)
cmpl   $0x80000004,-0x54(%rbp)
ja     13b2 <do_amd+0x292>
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   1040 <printregs@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    136b <do_amd+0x24b>
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x80000007,%eax
cmp    %rax,-0x18(%rbp)
jb     140b <do_amd+0x2eb>
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     1406 <do_amd+0x2e6>
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    140b <do_amd+0x2eb>
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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    0xfa7(%rip),%rdi
call   1040 <puts@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    0xea2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x6,%ebp
je     11a1 <do_amd+0x61>
cmp    $0x5,%ebp
je     11c2 <do_amd+0x82>
cmp    $0x4,%ebp
jne    1230 <do_amd+0xf0>
lea    0xe94(%rip),%rdi
jmp    11dc <do_amd+0x9c>
lea    -0x1(%rbx),%eax
cmp    $0x6,%eax
ja     1207 <do_amd+0xc7>
lea    0xe50(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xef4(%rip),%rdi
jmp    11dc <do_amd+0x9c>
cmp    $0x9,%ebx
ja     1324 <do_amd+0x1e4>
mov    $0xcf,%eax
bt     %ebx,%eax
jae    11e7 <do_amd+0xa7>
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1230 <do_amd+0xf0>
cmp    $0x8,%ebx
je     1222 <do_amd+0xe2>
cmp    $0x9,%ebx
jne    1324 <do_amd+0x1e4>
lea    0xe51(%rip),%rdi
jmp    1229 <do_amd+0xe9>
lea    0xe66(%rip),%rdi
jmp    1229 <do_amd+0xe9>
lea    0xea0(%rip),%rdi
jmp    11dc <do_amd+0x9c>
lea    0xe62(%rip),%rdi
jmp    1229 <do_amd+0xe9>
lea    0xe79(%rip),%rdi
jmp    1229 <do_amd+0xe9>
lea    0xe17(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed9(%rip),%rdi
call   1040 <puts@plt>
mov    $0x80000000,%eax
cpuid
test   %rax,%rax
je     1313 <do_amd+0x1d3>
mov    %rax,%r12
mov    %r14,%r15
shr    $0xc,%r15
and    $0xf,%r14d
shr    %rax
cmp    $0x40000001,%rax
jb     12ff <do_amd+0x1bf>
mov    $0x80000001,%r13d
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x80000002,%eax
cpuid
mov    %rdx,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rcx,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1060 <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   1060 <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   1060 <printregs@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x5,%r13
cmp    %r13,%r12
jbe    12ff <do_amd+0x1bf>
mov    $0x80000007,%eax
cpuid
test   $0x1,%dl
je     12ff <do_amd+0x1bf>
lea    0xe18(%rip),%rdi
call   1040 <puts@plt>
lea    0xdd8(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd31(%rip),%rdi
jmp    11dc <do_amd+0x9c>

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

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