#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 /*<<< orphan*/ printf(char *, char const *);
scalar_t__ strstr(char const *, char *);
void csv_cstate_cpu_header(const char *cpu,
                           __attribute__((unused)) void *report_data) {
  if (strstr(cpu, "cluster"))
    printf("%s\n", cpu);
  else if (strstr(cpu, "core"))
    printf(",%s\n", cpu);
  else
    printf(",,%s\n", cpu);
}


x86 assembly (clang, -O0):
<csv_cstate_cpu_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     115f <csv_cstate_cpu_header+0x3f>
mov    -0x8(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <csv_cstate_cpu_header+0x83>
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     118e <csv_cstate_cpu_header+0x6e>
mov    -0x8(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
jmp    119e <csv_cstate_cpu_header+0x7e>
mov    -0x8(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <csv_cstate_cpu_header+0x83>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csv_cstate_cpu_header>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     113e <csv_cstate_cpu_header+0x1e>
lea    0xed3(%rip),%rdi
jmp    1162 <csv_cstate_cpu_header+0x42>
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
lea    0xeb6(%rip),%rax
lea    0xeb0(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"cluster\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [5 x i8] c"core\00"
@.str.3 = [5 x i8] c",%s\0A\00"
@.str.4 = [6 x i8] c",,%s\0A\00"
define void @csv_cstate_cpu_header(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i64 @strstr(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %22
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i64 @strstr(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %16)
br label %21
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %15
br label %22
22: ; preds = %21, %8
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"cluster\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [5 x i8] c"core\00"
@.str.3 = [5 x i8] c",%s\0A\00"
@.str.4 = [6 x i8] c",,%s\0A\00"
define void @csv_cstate_cpu_header(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
br label %9
9: ; preds = %5, %2
%10 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %8, %5 ]
%11 = tail call i32 @printf(i8* %10, i8* %0)
ret void
}