#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*/ chaz_ConfWriter_add_def(char *, char const *);
int /*<<< orphan*/ chaz_ConfWriter_end_module();
int /*<<< orphan*/ chaz_ConfWriter_start_module(char *);
scalar_t__ chaz_FuncMacro_probe_gnu();
int /*<<< orphan*/ chaz_FuncMacro_probe_inline();
scalar_t__ chaz_FuncMacro_probe_iso();
void chaz_FuncMacro_run(void) {
  int has_funcmac = 0;
  int has_iso_funcmac = 0;
  int has_gnuc_funcmac = 0;
  chaz_ConfWriter_start_module("FuncMacro");
  if (chaz_FuncMacro_probe_iso()) {
    has_funcmac = 1;
    has_iso_funcmac = 1;
  }
  if (chaz_FuncMacro_probe_gnu()) {
    has_funcmac = 1;
    has_gnuc_funcmac = 1;
  }
  if (has_funcmac) {
    const char *macro_text = has_iso_funcmac ? "__func__" : "__FUNCTION__";
    chaz_ConfWriter_add_def("HAS_FUNC_MACRO", NULL);
    chaz_ConfWriter_add_def("FUNC_MACRO", macro_text);
  }
  if (has_iso_funcmac) {
    chaz_ConfWriter_add_def("HAS_ISO_FUNC_MACRO", NULL);
  }
  if (has_gnuc_funcmac) {
    chaz_ConfWriter_add_def("HAS_GNUC_FUNC_MACRO", NULL);
  }
  chaz_FuncMacro_probe_inline();
  chaz_ConfWriter_end_module();
}


x86 assembly (clang, -O0):
<chaz_FuncMacro_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe7c(%rip),%rdi
call   1030 <chaz_ConfWriter_start_module@plt>
mov    $0x0,%al
call   1080 <chaz_FuncMacro_probe_iso@plt>
cmp    $0x0,%rax
je     11a8 <chaz_FuncMacro_run+0x48>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1060 <chaz_FuncMacro_probe_gnu@plt>
cmp    $0x0,%rax
je     11c7 <chaz_FuncMacro_run+0x67>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     120d <chaz_FuncMacro_run+0xad>
mov    -0x8(%rbp),%edx
lea    0xe38(%rip),%rax
lea    0xe28(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x18(%rbp)
lea    0xe2c(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <chaz_ConfWriter_add_def@plt>
mov    -0x18(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1050 <chaz_ConfWriter_add_def@plt>
cmpl   $0x0,-0x8(%rbp)
je     1227 <chaz_FuncMacro_run+0xc7>
lea    0xe11(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <chaz_ConfWriter_add_def@plt>
cmpl   $0x0,-0xc(%rbp)
je     1241 <chaz_FuncMacro_run+0xe1>
lea    0xe0a(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <chaz_ConfWriter_add_def@plt>
mov    $0x0,%al
call   1040 <chaz_FuncMacro_probe_inline@plt>
mov    $0x0,%al
call   1070 <chaz_ConfWriter_end_module@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaz_FuncMacro_run>:
push   %r15
push   %r14
push   %rbx
lea    0xe94(%rip),%rdi
call   1030 <chaz_ConfWriter_start_module@plt>
xor    %eax,%eax
call   1080 <chaz_FuncMacro_probe_iso@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <chaz_FuncMacro_probe_gnu@plt>
mov    %rax,%r14
or     %rbx,%rax
je     11bc <chaz_FuncMacro_run+0x5c>
test   %rbx,%rbx
lea    0xe7f(%rip),%rax
lea    0xe6f(%rip),%r15
cmove  %rax,%r15
lea    0xe7a(%rip),%rdi
xor    %esi,%esi
call   1050 <chaz_ConfWriter_add_def@plt>
lea    0xe97(%rip),%rdi
mov    %r15,%rsi
call   1050 <chaz_ConfWriter_add_def@plt>
test   %rbx,%rbx
je     11cf <chaz_FuncMacro_run+0x6f>
lea    0xe67(%rip),%rdi
xor    %esi,%esi
call   1050 <chaz_ConfWriter_add_def@plt>
test   %r14,%r14
je     11e2 <chaz_FuncMacro_run+0x82>
lea    0xe67(%rip),%rdi
xor    %esi,%esi
call   1050 <chaz_ConfWriter_add_def@plt>
xor    %eax,%eax
call   1040 <chaz_FuncMacro_probe_inline@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <chaz_ConfWriter_end_module@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"FuncMacro\00"
@.str.1 = [9 x i8] c"__func__\00"
@.str.2 = [13 x i8] c"__FUNCTION__\00"
@.str.3 = [15 x i8] c"HAS_FUNC_MACRO\00"
@.str.4 = [11 x i8] c"FUNC_MACRO\00"
@.str.5 = [19 x i8] c"HAS_ISO_FUNC_MACRO\00"
@.str.6 = [20 x i8] c"HAS_GNUC_FUNC_MACRO\00"
define void @chaz_FuncMacro_run() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%5 = call i32 @chaz_ConfWriter_start_module(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i64 (...) @chaz_FuncMacro_probe_iso()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
store i32 1, i32* %2
br label %9
9: ; preds = %8, %0
%10 = call i64 (...) @chaz_FuncMacro_probe_gnu()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %1
store i32 1, i32* %3
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %1
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0)
store i8* %20, i8** %4
%21 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* null)
%22 = load i8*, i8** %4
%23 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %16, %13
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* null)
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %3
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* null)
br label %34
34: ; preds = %32, %29
%35 = call i32 (...) @chaz_FuncMacro_probe_inline()
%36 = call i32 (...) @chaz_ConfWriter_end_module()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"FuncMacro\00"
@.str.1 = [9 x i8] c"__func__\00"
@.str.2 = [13 x i8] c"__FUNCTION__\00"
@.str.3 = [15 x i8] c"HAS_FUNC_MACRO\00"
@.str.4 = [11 x i8] c"FUNC_MACRO\00"
@.str.5 = [19 x i8] c"HAS_ISO_FUNC_MACRO\00"
@.str.6 = [20 x i8] c"HAS_GNUC_FUNC_MACRO\00"
define void @chaz_FuncMacro_run() {
%1 = tail call i32 @chaz_ConfWriter_start_module(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 (...) @chaz_FuncMacro_probe_iso()
%3 = icmp eq i64 %2, 0
%4 = tail call i64 (...) @chaz_FuncMacro_probe_gnu()
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i1 %3, i1 false
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = select i1 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
%9 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* null)
%10 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %11
11: ; preds = %7, %0
br i1 %3, label %14, label %12
12: ; preds = %11
%13 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* null)
br label %14
14: ; preds = %12, %11
br i1 %5, label %17, label %15
15: ; preds = %14
%16 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* null)
br label %17
17: ; preds = %15, %14
%18 = tail call i32 (...) @chaz_FuncMacro_probe_inline()
%19 = tail call i32 (...) @chaz_ConfWriter_end_module()
ret void
}