#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_end_module();
int /*<<< orphan*/ chaz_ConfWriter_start_module(char *);
scalar_t__ chaz_HeadCheck_check_header(char *);
scalar_t__ chaz_HeadCheck_defines_symbol(char *, char *);
void chaz_AtomicOps_run(void) {
  chaz_ConfWriter_start_module("AtomicOps");
  if (chaz_HeadCheck_check_header("stdatomic.h")) {
    chaz_ConfWriter_add_def("HAS_STDATOMIC_H", NULL);
  }
  if (chaz_HeadCheck_check_header("libkern/OSAtomic.h")) {
    chaz_ConfWriter_add_def("HAS_LIBKERN_OSATOMIC_H", NULL);
    if (chaz_HeadCheck_defines_symbol("OSAtomicCompareAndSwapPtr",
                                      "#include <libkern/OSAtomic.h>")) {
      chaz_ConfWriter_add_def("HAS_OSATOMIC_CAS_PTR", NULL);
    }
  }
  if (chaz_HeadCheck_check_header("sys/atomic.h")) {
    chaz_ConfWriter_add_def("HAS_SYS_ATOMIC_H", NULL);
  }
  if (chaz_HeadCheck_check_header("windows.h") &&
      chaz_HeadCheck_check_header("intrin.h")) {
    chaz_ConfWriter_add_def("HAS_INTRIN_H", NULL);
  }
  chaz_ConfWriter_end_module();
}


x86 assembly (clang, -O0):
<chaz_AtomicOps_run>:
push   %rbp
mov    %rsp,%rbp
lea    0xea5(%rip),%rdi
call   1030 <chaz_ConfWriter_start_module@plt>
lea    0xea3(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
cmp    $0x0,%rax
je     1186 <chaz_AtomicOps_run+0x36>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xe99(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
cmp    $0x0,%rax
je     11de <chaz_AtomicOps_run+0x8e>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xe9d(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1070 <chaz_HeadCheck_defines_symbol@plt>
cmp    $0x0,%rax
je     11d9 <chaz_AtomicOps_run+0x89>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
jmp    11de <chaz_AtomicOps_run+0x8e>
lea    0xeb8(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
cmp    $0x0,%rax
je     1204 <chaz_AtomicOps_run+0xb4>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xeb0(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
cmp    $0x0,%rax
je     1240 <chaz_AtomicOps_run+0xf0>
lea    0xea4(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
cmp    $0x0,%rax
je     1240 <chaz_AtomicOps_run+0xf0>
lea    0xe97(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
mov    $0x0,%al
call   1060 <chaz_ConfWriter_end_module@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaz_AtomicOps_run>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <chaz_ConfWriter_start_module@plt>
lea    0xea6(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
test   %rax,%rax
je     117c <chaz_AtomicOps_run+0x2c>
lea    0xea1(%rip),%rdi
xor    %esi,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xea3(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
test   %rax,%rax
je     11c1 <chaz_AtomicOps_run+0x71>
lea    0xea5(%rip),%rdi
xor    %esi,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xeae(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1070 <chaz_HeadCheck_defines_symbol@plt>
test   %rax,%rax
je     11c1 <chaz_AtomicOps_run+0x71>
lea    0xece(%rip),%rdi
xor    %esi,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xed5(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
test   %rax,%rax
je     11e0 <chaz_AtomicOps_run+0x90>
lea    0xed1(%rip),%rdi
xor    %esi,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xed4(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
test   %rax,%rax
je     1210 <chaz_AtomicOps_run+0xc0>
lea    0xecd(%rip),%rdi
call   1050 <chaz_HeadCheck_check_header@plt>
test   %rax,%rax
je     1210 <chaz_AtomicOps_run+0xc0>
lea    0xec5(%rip),%rdi
xor    %esi,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <chaz_ConfWriter_end_module@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"AtomicOps\00"
@.str.1 = [12 x i8] c"stdatomic.h\00"
@.str.2 = [16 x i8] c"HAS_STDATOMIC_H\00"
@.str.3 = [19 x i8] c"libkern/OSAtomic.h\00"
@.str.4 = [23 x i8] c"HAS_LIBKERN_OSATOMIC_H\00"
@.str.5 = [26 x i8] c"OSAtomicCompareAndSwapPtr\00"
@.str.6 = [30 x i8] c"#include <libkern/OSAtomic.h>\00"
@.str.7 = [21 x i8] c"HAS_OSATOMIC_CAS_PTR\00"
@.str.8 = [13 x i8] c"sys/atomic.h\00"
@.str.9 = [17 x i8] c"HAS_SYS_ATOMIC_H\00"
@.str.10 = [10 x i8] c"windows.h\00"
@.str.11 = [9 x i8] c"intrin.h\00"
@.str.12 = [13 x i8] c"HAS_INTRIN_H\00"
define void @chaz_AtomicOps_run() {
%1 = call i32 @chaz_ConfWriter_start_module(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32* null)
br label %6
6: ; preds = %4, %0
%7 = call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32* null)
%11 = call i64 @chaz_HeadCheck_defines_symbol(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32* null)
br label %15
15: ; preds = %13, %9
br label %16
16: ; preds = %15, %6
%17 = call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32* null)
br label %21
21: ; preds = %19, %16
%22 = call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32* null)
br label %29
29: ; preds = %27, %24, %21
%30 = call i32 (...) @chaz_ConfWriter_end_module()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"AtomicOps\00"
@.str.1 = [12 x i8] c"stdatomic.h\00"
@.str.2 = [16 x i8] c"HAS_STDATOMIC_H\00"
@.str.3 = [19 x i8] c"libkern/OSAtomic.h\00"
@.str.4 = [23 x i8] c"HAS_LIBKERN_OSATOMIC_H\00"
@.str.5 = [26 x i8] c"OSAtomicCompareAndSwapPtr\00"
@.str.6 = [30 x i8] c"#include <libkern/OSAtomic.h>\00"
@.str.7 = [21 x i8] c"HAS_OSATOMIC_CAS_PTR\00"
@.str.8 = [13 x i8] c"sys/atomic.h\00"
@.str.9 = [17 x i8] c"HAS_SYS_ATOMIC_H\00"
@.str.10 = [10 x i8] c"windows.h\00"
@.str.11 = [9 x i8] c"intrin.h\00"
@.str.12 = [13 x i8] c"HAS_INTRIN_H\00"
define void @chaz_AtomicOps_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_HeadCheck_check_header(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32* null)
br label %6
6: ; preds = %4, %0
%7 = tail call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32* null)
%11 = tail call i64 @chaz_HeadCheck_defines_symbol(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32* null)
br label %15
15: ; preds = %9, %13, %6
%16 = tail call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32* null)
br label %20
20: ; preds = %18, %15
%21 = tail call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %20
%24 = tail call i64 @chaz_HeadCheck_check_header(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32* null)
br label %28
28: ; preds = %26, %23, %20
%29 = tail call i32 (...) @chaz_ConfWriter_end_module()
ret void
}