#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_cpuconfig(void) {
  if (detect() == 2) {
    printf("#define LOONGSON3A\n");
    printf("#define L1_DATA_SIZE 65536\n");
    printf("#define L1_DATA_LINESIZE 32\n");
    printf("#define L2_SIZE 512488\n");
    printf("#define L2_LINESIZE 32\n");
    printf("#define DTB_DEFAULT_ENTRIES 64\n");
    printf("#define DTB_SIZE 4096\n");
    printf("#define L2_ASSOCIATIVE 4\n");
  } else if (detect() == 3) {
    printf("#define LOONGSON3B\n");
    printf("#define L1_DATA_SIZE 65536\n");
    printf("#define L1_DATA_LINESIZE 32\n");
    printf("#define L2_SIZE 512488\n");
    printf("#define L2_LINESIZE 32\n");
    printf("#define DTB_DEFAULT_ENTRIES 64\n");
    printf("#define DTB_SIZE 4096\n");
    printf("#define L2_ASSOCIATIVE 4\n");
  } else {
    printf("#define SICORTEX\n");
    printf("#define L1_DATA_SIZE 32768\n");
    printf("#define L1_DATA_LINESIZE 32\n");
    printf("#define L2_SIZE 512488\n");
    printf("#define L2_LINESIZE 32\n");
    printf("#define DTB_DEFAULT_ENTRIES 32\n");
    printf("#define DTB_SIZE 4096\n");
    printf("#define L2_ASSOCIATIVE 8\n");
  }
}


x86 assembly (clang, -O0):
<get_cpuconfig>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x2,%eax
jne    1199 <get_cpuconfig+0x79>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1a(%rip),%rdi
call   1030 <printf@plt>
lea    0xf25(%rip),%rdi
call   1030 <printf@plt>
jmp    1273 <get_cpuconfig+0x153>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x3,%eax
jne    120e <get_cpuconfig+0xee>
lea    0xf1e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    126e <get_cpuconfig+0x14e>
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    1273 <get_cpuconfig+0x153>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cpuconfig>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <detect@plt>
lea    0xfd5(%rip),%rcx
mov    %rcx,(%rsp)
lea    0xf94(%rip),%r15
lea    0xf76(%rip),%r12
lea    0xf53(%rip),%r13
cmp    $0x2,%eax
jne    1175 <get_cpuconfig+0x55>
lea    0xfc6(%rip),%rbx
lea    0xf8a(%rip),%rbp
lea    0xf1e(%rip),%r14
lea    0xf04(%rip),%rdi
jmp    11c7 <get_cpuconfig+0xa7>
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x3,%eax
lea    0xede(%rip),%rax
lea    0xe73(%rip),%rdi
cmove  %rax,%rdi
lea    0xef2(%rip),%rax
lea    0xe72(%rip),%r14
cmove  %rax,%r14
lea    0xf45(%rip),%rax
lea    0xe7b(%rip),%rbp
cmove  %rax,%rbp
lea    0xf68(%rip),%rax
lea    0xe88(%rip),%rbx
cmove  %rax,%rbx
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"#define LOONGSON3A\0A\00"
@.str.1 = [28 x i8] c"#define L1_DATA_SIZE 65536\0A\00"
@.str.2 = [29 x i8] c"#define L1_DATA_LINESIZE 32\0A\00"
@.str.3 = [24 x i8] c"#define L2_SIZE 512488\0A\00"
@.str.4 = [24 x i8] c"#define L2_LINESIZE 32\0A\00"
@.str.5 = [32 x i8] c"#define DTB_DEFAULT_ENTRIES 64\0A\00"
@.str.6 = [23 x i8] c"#define DTB_SIZE 4096\0A\00"
@.str.7 = [26 x i8] c"#define L2_ASSOCIATIVE 4\0A\00"
@.str.8 = [20 x i8] c"#define LOONGSON3B\0A\00"
@.str.9 = [18 x i8] c"#define SICORTEX\0A\00"
@.str.10 = [28 x i8] c"#define L1_DATA_SIZE 32768\0A\00"
@.str.11 = [32 x i8] c"#define DTB_DEFAULT_ENTRIES 32\0A\00"
@.str.12 = [26 x i8] c"#define L2_ASSOCIATIVE 8\0A\00"
define void @get_cpuconfig() {
%1 = call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
br label %34
12: ; preds = %0
%13 = call i32 (...) @detect()
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
br label %33
24: ; preds = %12
%25 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
br label %33
33: ; preds = %24, %15
br label %34
34: ; preds = %33, %3
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"#define SICORTEX\00"
@str.13 = [27 x i8] c"#define L1_DATA_SIZE 32768\00"
@str.17 = [31 x i8] c"#define DTB_DEFAULT_ENTRIES 32\00"
@str.19 = [25 x i8] c"#define L2_ASSOCIATIVE 8\00"
@str.20 = [19 x i8] c"#define LOONGSON3B\00"
@str.28 = [19 x i8] c"#define LOONGSON3A\00"
@str.29 = [27 x i8] c"#define L1_DATA_SIZE 65536\00"
@str.30 = [28 x i8] c"#define L1_DATA_LINESIZE 32\00"
@str.31 = [23 x i8] c"#define L2_SIZE 512488\00"
@str.32 = [23 x i8] c"#define L2_LINESIZE 32\00"
@str.33 = [31 x i8] c"#define DTB_DEFAULT_ENTRIES 64\00"
@str.34 = [22 x i8] c"#define DTB_SIZE 4096\00"
@str.35 = [25 x i8] c"#define L2_ASSOCIATIVE 4\00"
define void @get_cpuconfig() {
%1 = tail call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %14, label %3
3: ; preds = %0
%4 = tail call i32 (...) @detect()
%5 = icmp eq i32 %4, 3
%6 = select i1 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0)
%7 = select i1 %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.29, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.13, i64 0, i64 0)
%8 = select i1 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.30, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.30, i64 0, i64 0)
%9 = select i1 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.31, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.31, i64 0, i64 0)
%10 = select i1 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.32, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.32, i64 0, i64 0)
%11 = select i1 %5, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @str.33, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @str.17, i64 0, i64 0)
%12 = select i1 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str.34, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str.34, i64 0, i64 0)
%13 = select i1 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.35, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.19, i64 0, i64 0)
br label %14
14: ; preds = %3, %0
%15 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.28, i64 0, i64 0), %0 ], [ %6, %3 ]
%16 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.29, i64 0, i64 0), %0 ], [ %7, %3 ]
%17 = phi i8* [ getelementptr inbounds ([28 x i8], [28 x i8]* @str.30, i64 0, i64 0), %0 ], [ %8, %3 ]
%18 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.31, i64 0, i64 0), %0 ], [ %9, %3 ]
%19 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.32, i64 0, i64 0), %0 ], [ %10, %3 ]
%20 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @str.33, i64 0, i64 0), %0 ], [ %11, %3 ]
%21 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.34, i64 0, i64 0), %0 ], [ %12, %3 ]
%22 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.35, i64 0, i64 0), %0 ], [ %13, %3 ]
%23 = tail call i32 @puts(i8* dereferenceable(1) %15)
%24 = tail call i32 @puts(i8* dereferenceable(1) %16)
%25 = tail call i32 @puts(i8* dereferenceable(1) %17)
%26 = tail call i32 @puts(i8* dereferenceable(1) %18)
%27 = tail call i32 @puts(i8* dereferenceable(1) %19)
%28 = tail call i32 @puts(i8* dereferenceable(1) %20)
%29 = tail call i32 @puts(i8* dereferenceable(1) %21)
%30 = tail call i32 @puts(i8* dereferenceable(1) %22)
ret void
}