int main(void) {
  int result = 0;
  int __integer_type;
  void *__pointer_type;
  double __real_type;
  __complex__ double __complex_type;
  struct {
    int a;
  } __record_type;
  union {
    int a;
    int b;
  } __union_type;
  result |= ({
    int wrong = (__builtin_classify_type(__integer_type) != 1);
    printf("%-15s is %d: %s\n", "integer",
           __builtin_classify_type(__integer_type), wrong ? "WRONG" : "OK");
    wrong;
  });
  result |= ({
    int wrong = (__builtin_classify_type(__pointer_type) != 5);
    printf("%-15s is %d: %s\n", "pointer",
           __builtin_classify_type(__pointer_type), wrong ? "WRONG" : "OK");
    wrong;
  });
  result |= ({
    int wrong = (__builtin_classify_type(__real_type) != 8);
    printf("%-15s is %d: %s\n", "real", __builtin_classify_type(__real_type),
           wrong ? "WRONG" : "OK");
    wrong;
  });
  result |= ({
    int wrong = (__builtin_classify_type(__complex_type) != 9);
    printf("%-15s is %d: %s\n", "complex",
           __builtin_classify_type(__complex_type), wrong ? "WRONG" : "OK");
    wrong;
  });
  result |= ({
    int wrong = (__builtin_classify_type(__record_type) != 12);
    printf("%-15s is %d: %s\n", "record",
           __builtin_classify_type(__record_type), wrong ? "WRONG" : "OK");
    wrong;
  });
  result |= ({
    int wrong = (__builtin_classify_type(__union_type) != 13);
    printf("%-15s is %d: %s\n", "union", __builtin_classify_type(__union_type),
           wrong ? "WRONG" : "OK");
    wrong;
  });
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%edx
lea    0xee8(%rip),%rcx
lea    0xedb(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
lea    0xeb4(%rip),%rdi
lea    0xebe(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%edx
lea    0xea0(%rip),%rcx
lea    0xe93(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
lea    0xe6c(%rip),%rdi
lea    0xe87(%rip),%rsi
mov    $0x5,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%edx
lea    0xe58(%rip),%rcx
lea    0xe4b(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
lea    0xe24(%rip),%rdi
lea    0xe47(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%edx
lea    0xe10(%rip),%rcx
lea    0xe03(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
lea    0xddc(%rip),%rdi
lea    0xe04(%rip),%rsi
mov    $0x9,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%edx
lea    0xdc8(%rip),%rcx
lea    0xdbb(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
lea    0xd94(%rip),%rdi
lea    0xdc4(%rip),%rsi
mov    $0xc,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%edx
lea    0xd80(%rip),%rcx
lea    0xd73(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
lea    0xd4c(%rip),%rdi
lea    0xd83(%rip),%rsi
mov    $0xd,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rbx
lea    0xeef(%rip),%rsi
lea    0xef0(%rip),%r14
mov    %rbx,%rdi
mov    $0x1,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
mov    $0xc,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
mov    $0xd,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.anon = type { i32 }
%union.anon = type { i32 }
@.str = [17 x i8] c"%-15s is %d: %s\0A\00"
@.str.1 = [8 x i8] c"integer\00"
@.str.2 = [6 x i8] c"WRONG\00"
@.str.3 = [3 x i8] c"OK\00"
@.str.4 = [8 x i8] c"pointer\00"
@.str.5 = [5 x i8] c"real\00"
@.str.6 = [8 x i8] c"complex\00"
@.str.7 = [7 x i8] c"record\00"
@.str.8 = [6 x i8] c"union\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double
%6 = alloca { double, double }
%7 = alloca %struct.anon
%8 = alloca %union.anon
%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
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %9
%21 = load i32, i32* %9
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1, i8* %24)
%26 = load i32, i32* %9
store i32 %26, i32* %10
%27 = load i32, i32* %10
%28 = load i32, i32* %2
%29 = or i32 %28, %27
store i32 %29, i32* %2
store i32 0, i32* %11
%30 = load i32, i32* %11
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 5, i8* %33)
%35 = load i32, i32* %11
store i32 %35, i32* %12
%36 = load i32, i32* %12
%37 = load i32, i32* %2
%38 = or i32 %37, %36
store i32 %38, i32* %2
store i32 0, i32* %13
%39 = load i32, i32* %13
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 8, i8* %42)
%44 = load i32, i32* %13
store i32 %44, i32* %14
%45 = load i32, i32* %14
%46 = load i32, i32* %2
%47 = or i32 %46, %45
store i32 %47, i32* %2
store i32 0, i32* %15
%48 = load i32, i32* %15
%49 = icmp ne i32 %48, 0
%50 = zext i1 %49 to i64
%51 = select i1 %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 9, i8* %51)
%53 = load i32, i32* %15
store i32 %53, i32* %16
%54 = load i32, i32* %16
%55 = load i32, i32* %2
%56 = or i32 %55, %54
store i32 %56, i32* %2
store i32 0, i32* %17
%57 = load i32, i32* %17
%58 = icmp ne i32 %57, 0
%59 = zext i1 %58 to i64
%60 = select i1 %58, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 12, i8* %60)
%62 = load i32, i32* %17
store i32 %62, i32* %18
%63 = load i32, i32* %18
%64 = load i32, i32* %2
%65 = or i32 %64, %63
store i32 %65, i32* %2
store i32 0, i32* %19
%66 = load i32, i32* %19
%67 = icmp ne i32 %66, 0
%68 = zext i1 %67 to i64
%69 = select i1 %67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 13, i8* %69)
%71 = load i32, i32* %19
store i32 %71, i32* %20
%72 = load i32, i32* %20
%73 = load i32, i32* %2
%74 = or i32 %73, %72
store i32 %74, i32* %2
%75 = load i32, i32* %2
ret i32 %75
}

LLVM IR (-O2):
@.str = [17 x i8] c"%-15s is %d: %s\0A\00"
@.str.1 = [8 x i8] c"integer\00"
@.str.3 = [3 x i8] c"OK\00"
@.str.4 = [8 x i8] c"pointer\00"
@.str.5 = [5 x i8] c"real\00"
@.str.6 = [8 x i8] c"complex\00"
@.str.7 = [7 x i8] c"record\00"
@.str.8 = [6 x i8] c"union\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}