#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 {
    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    11c3 <get_subarchitecture+0xa3>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x3,%eax
jne    1166 <get_subarchitecture+0x46>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11be <get_subarchitecture+0x9e>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x4,%eax
jne    1187 <get_subarchitecture+0x67>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    11b9 <get_subarchitecture+0x99>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x5,%eax
jne    11a8 <get_subarchitecture+0x88>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    11b4 <get_subarchitecture+0x94>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    11b9 <get_subarchitecture+0x99>
jmp    11be <get_subarchitecture+0x9e>
jmp    11c3 <get_subarchitecture+0xa3>
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
lea    0xe9f(%rip),%rax
lea    0xe9e(%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 = [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 %25
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 %24
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 %23
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 %22
20: ; preds = %15
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
br label %23
23: ; preds = %22, %13
br label %24
24: ; preds = %23, %8
br label %25
25: ; preds = %24, %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 = [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 %13, label %3
3: ; preds = %0
%4 = tail call i32 (...) @detect()
%5 = icmp eq i32 %4, 3
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i32 (...) @detect()
%8 = icmp eq i32 %7, 4
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 (...) @detect()
%11 = icmp eq i32 %10, 5
%12 = select i1 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0)
br label %13
13: ; preds = %9, %6, %3, %0
%14 = 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 ], [ %12, %9 ]
%15 = tail call i32 @printf(i8* dereferenceable(1) %14)
ret void
}