#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 *, int /*<<< orphan*/ *);
int /*<<< orphan*/ chaz_ConfWriter_add_sys_include(char *);
int /*<<< orphan*/ chaz_ConfWriter_append_conf(char *);
int /*<<< orphan*/ chaz_ConfWriter_end_module();
int /*<<< orphan*/ chaz_ConfWriter_start_module(char *);
int chaz_HeadCheck_check_header(char *);
void chaz_Booleans_run(void) {
  int has_stdbool = chaz_HeadCheck_check_header("stdbool.h");
  chaz_ConfWriter_start_module("Booleans");
  if (has_stdbool) {
    chaz_ConfWriter_add_def("HAS_STDBOOL_H", NULL);
    chaz_ConfWriter_add_sys_include("stdbool.h");
  } else {
    chaz_ConfWriter_append_conf(
        "#if (defined(CHY_EMPLOY_BOOLEANS) && !defined(__cplusplus))\n"
        "  typedef int bool;\n"
        "  #ifndef true\n"
        "    #define true 1\n"
        "  #endif\n"
        "  #ifndef false\n"
        "    #define false 0\n"
        "  #endif\n"
        "#endif\n");
  }
  chaz_ConfWriter_end_module();
}


x86 assembly (clang, -O0):
<chaz_Booleans_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1070 <chaz_HeadCheck_check_header@plt>
mov    %eax,-0x4(%rbp)
lea    0xe8c(%rip),%rdi
call   1030 <chaz_ConfWriter_start_module@plt>
cmpl   $0x0,-0x4(%rbp)
je     11ae <chaz_Booleans_run+0x4e>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <chaz_ConfWriter_add_def@plt>
lea    0xe5c(%rip),%rdi
call   1050 <chaz_ConfWriter_add_sys_include@plt>
jmp    11ba <chaz_Booleans_run+0x5a>
lea    0xe6c(%rip),%rdi
call   1040 <chaz_ConfWriter_append_conf@plt>
mov    $0x0,%al
call   1080 <chaz_ConfWriter_end_module@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaz_Booleans_run>:
push   %rbx
lea    0xe98(%rip),%rdi
call   1070 <chaz_HeadCheck_check_header@plt>
mov    %eax,%ebx
lea    0xe94(%rip),%rdi
call   1030 <chaz_ConfWriter_start_module@plt>
test   %ebx,%ebx
je     119b <chaz_Booleans_run+0x3b>
lea    0xe8d(%rip),%rdi
xor    %esi,%esi
call   1060 <chaz_ConfWriter_add_def@plt>
lea    0xe6c(%rip),%rdi
call   1050 <chaz_ConfWriter_add_sys_include@plt>
jmp    11a7 <chaz_Booleans_run+0x47>
lea    0xe7f(%rip),%rdi
call   1040 <chaz_ConfWriter_append_conf@plt>
xor    %eax,%eax
pop    %rbx
jmp    1080 <chaz_ConfWriter_end_module@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"stdbool.h\00"
@.str.1 = [9 x i8] c"Booleans\00"
@.str.2 = [14 x i8] c"HAS_STDBOOL_H\00"
@.str.3 = [176 x i8] c"#if (defined(CHY_EMPLOY_BOOLEANS) && !defined(__cplusplus))\0A typedef int bool;\0A #ifndef true\0A #define true 1\0A #endif\0A #ifndef false\0A #define false 0\0A #endif\0A#endif\0A\00"
define void @chaz_Booleans_run() {
%1 = alloca i32
%2 = call i32 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = call i32 @chaz_ConfWriter_start_module(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* null)
%8 = call i32 @chaz_ConfWriter_add_sys_include(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @chaz_ConfWriter_append_conf(i8* getelementptr inbounds ([176 x i8], [176 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = call i32 (...) @chaz_ConfWriter_end_module()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"stdbool.h\00"
@.str.1 = [9 x i8] c"Booleans\00"
@.str.2 = [14 x i8] c"HAS_STDBOOL_H\00"
@.str.3 = [176 x i8] c"#if (defined(CHY_EMPLOY_BOOLEANS) && !defined(__cplusplus))\0A typedef int bool;\0A #ifndef true\0A #define true 1\0A #endif\0A #ifndef false\0A #define false 0\0A #endif\0A#endif\0A\00"
define void @chaz_Booleans_run() {
%1 = tail call i32 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @chaz_ConfWriter_start_module(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %1, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* null)
%6 = tail call i32 @chaz_ConfWriter_add_sys_include(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %0
%8 = tail call i32 @chaz_ConfWriter_append_conf(i8* getelementptr inbounds ([176 x i8], [176 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
%10 = tail call i32 (...) @chaz_ConfWriter_end_module()
ret void
}