#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int detect();
int /*<<< orphan*/ printf(char *);
void get_subarchitecture(void) {
  if (detect() == 2) {
    printf("LOONGSON3A");
  } else if (detect() == 3) {
    printf("LOONGSON3B");
  } else if (detect() == 4) {
    printf("I6400");
  } else if (detect() == 5) {
    printf("P6600");
  } else if (detect() == 6) {
    printf("I6500");
  } else {
    printf("SICORTEX");
  }
}


x86 assembly (clang, -O0):
<get_subarchitecture>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x2,%eax
jne    1145 <get_subarchitecture+0x25>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <get_subarchitecture+0xc9>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x3,%eax
jne    1166 <get_subarchitecture+0x46>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11e4 <get_subarchitecture+0xc4>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x4,%eax
jne    1187 <get_subarchitecture+0x67>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    11df <get_subarchitecture+0xbf>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x5,%eax
jne    11a8 <get_subarchitecture+0x88>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    11da <get_subarchitecture+0xba>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x6,%eax
jne    11c9 <get_subarchitecture+0xa9>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    11d5 <get_subarchitecture+0xb5>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
jmp    11da <get_subarchitecture+0xba>
jmp    11df <get_subarchitecture+0xbf>
jmp    11e4 <get_subarchitecture+0xc4>
jmp    11e9 <get_subarchitecture+0xc9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_subarchitecture>:
push   %rax
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x2,%eax
jne    113a <get_subarchitecture+0x1a>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x3,%eax
jne    1153 <get_subarchitecture+0x33>
lea    0xebe(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x4,%eax
jne    116c <get_subarchitecture+0x4c>
lea    0xeb0(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x5,%eax
jne    1185 <get_subarchitecture+0x65>
lea    0xe9d(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x6,%eax
lea    0xe8c(%rip),%rax
lea    0xe8b(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"LOONGSON3A\00"
@.str.1 = [11 x i8] c"LOONGSON3B\00"
@.str.2 = [6 x i8] c"I6400\00"
@.str.3 = [6 x i8] c"P6600\00"
@.str.4 = [6 x i8] c"I6500\00"
@.str.5 = [9 x i8] c"SICORTEX\00"
define void @get_subarchitecture() {
%1 = call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %31
5: ; preds = %0
%6 = call i32 (...) @detect()
%7 = icmp eq i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %30
10: ; preds = %5
%11 = call i32 (...) @detect()
%12 = icmp eq i32 %11, 4
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %29
15: ; preds = %10
%16 = call i32 (...) @detect()
%17 = icmp eq i32 %16, 5
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %28
20: ; preds = %15
%21 = call i32 (...) @detect()
%22 = icmp eq i32 %21, 6
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
br label %28
28: ; preds = %27, %18
br label %29
29: ; preds = %28, %13
br label %30
30: ; preds = %29, %8
br label %31
31: ; preds = %30, %3
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"LOONGSON3A\00"
@.str.1 = [11 x i8] c"LOONGSON3B\00"
@.str.2 = [6 x i8] c"I6400\00"
@.str.3 = [6 x i8] c"P6600\00"
@.str.4 = [6 x i8] c"I6500\00"
@.str.5 = [9 x i8] c"SICORTEX\00"
define void @get_subarchitecture() {
%1 = tail call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %16, label %3
3: ; preds = %0
%4 = tail call i32 (...) @detect()
%5 = icmp eq i32 %4, 3
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = tail call i32 (...) @detect()
%8 = icmp eq i32 %7, 4
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i32 (...) @detect()
%11 = icmp eq i32 %10, 5
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = tail call i32 (...) @detect()
%14 = icmp eq i32 %13, 6
%15 = select i1 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0)
br label %16
16: ; preds = %12, %9, %6, %3, %0
%17 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %9 ], [ %15, %12 ]
%18 = tail call i32 @printf(i8* dereferenceable(1) %17)
ret void
}