#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*/ get_feature(char *);
int /*<<< orphan*/ printf(char *);
void get_cpuconfig(void) {
  int d = detect();
  switch (d) {
  case 2:
    printf("#define ARMV7\n");
    printf("#define HAVE_VFP\n");
    printf("#define HAVE_VFPV3\n");
    if (get_feature("neon"))
      printf("#define HAVE_NEON\n");
    if (get_feature("vfpv4"))
      printf("#define HAVE_VFPV4\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");
    break;
  case 1:
    printf("#define ARMV6\n");
    printf("#define HAVE_VFP\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");
    break;
  }
}


x86 assembly (clang, -O0):
<get_cpuconfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <detect@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1226 <get_cpuconfig+0xf6>
jmp    1156 <get_cpuconfig+0x26>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
jne    1292 <get_cpuconfig+0x162>
jmp    1167 <get_cpuconfig+0x37>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
call   1040 <get_feature@plt>
cmp    $0x0,%eax
je     11ac <get_cpuconfig+0x7c>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1040 <get_feature@plt>
cmp    $0x0,%eax
je     11cd <get_cpuconfig+0x9d>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
call   1030 <printf@plt>
jmp    1292 <get_cpuconfig+0x162>
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
lea    0xdd6(%rip),%rdi
call   1030 <printf@plt>
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cpuconfig>:
push   %rax
xor    %eax,%eax
call   1050 <detect@plt>
cmp    $0x1,%eax
je     119f <get_cpuconfig+0x6f>
cmp    $0x2,%eax
jne    120c <get_cpuconfig+0xdc>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8f(%rip),%rdi
call   1040 <get_feature@plt>
test   %eax,%eax
je     1186 <get_cpuconfig+0x56>
lea    0xf90(%rip),%rdi
call   1030 <puts@plt>
lea    0xe78(%rip),%rdi
call   1040 <get_feature@plt>
test   %eax,%eax
je     11b7 <get_cpuconfig+0x87>
lea    0xf61(%rip),%rdi
jmp    11b2 <get_cpuconfig+0x82>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
pop    %rax
ret

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

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