#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*/ *);
scalar_t__ chaz_HeadCheck_check_header(char const *);
scalar_t__ chaz_HeadCheck_check_many_headers(char const **);
int /*<<< orphan*/ chaz_Headers_keep(char const *);
void chaz_Headers_probe_c89(void) {
  const char *c89_headers[] = {"assert.h", "ctype.h",  "errno.h",  "float.h",
                               "limits.h", "locale.h", "math.h",   "setjmp.h",
                               "signal.h", "stdarg.h", "stddef.h", "stdio.h",
                               "stdlib.h", "string.h", "time.h",   NULL};
  int i;
  if (chaz_HeadCheck_check_many_headers((const char **)c89_headers)) {
    chaz_ConfWriter_add_def("HAS_C89", NULL);
    chaz_ConfWriter_add_def("HAS_C90", NULL);
    for (i = 0; c89_headers[i] != NULL; i++) {
      chaz_Headers_keep(c89_headers[i]);
    }
  } else {
    for (i = 0; c89_headers[i] != NULL; i++) {
      if (chaz_HeadCheck_check_header(c89_headers[i])) {
        chaz_Headers_keep(c89_headers[i]);
      }
    }
  }
}


x86 assembly (clang, -O0):
<chaz_Headers_probe_c89>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    -0x80(%rbp),%rdi
lea    0x2c3a(%rip),%rsi
mov    $0x80,%edx
call   1050 <memcpy@plt>
lea    -0x80(%rbp),%rdi
call   1030 <chaz_HeadCheck_check_many_headers@plt>
cmp    $0x0,%rax
je     11ea <chaz_Headers_probe_c89+0x9a>
lea    0xef5(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xeed(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rax
cmpq   $0x0,-0x80(%rbp,%rax,8)
je     11e5 <chaz_Headers_probe_c89+0x95>
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rdi
call   1070 <chaz_Headers_keep@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11ad <chaz_Headers_probe_c89+0x5d>
jmp    1251 <chaz_Headers_probe_c89+0x101>
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rax
cmpq   $0x0,-0x80(%rbp,%rax,8)
je     124c <chaz_Headers_probe_c89+0xfc>
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rdi
call   1060 <chaz_HeadCheck_check_header@plt>
cmp    $0x0,%rax
je     1233 <chaz_Headers_probe_c89+0xe3>
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rdi
call   1070 <chaz_Headers_keep@plt>
jmp    1238 <chaz_Headers_probe_c89+0xe8>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11f4 <chaz_Headers_probe_c89+0xa4>
jmp    1251 <chaz_Headers_probe_c89+0x101>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaz_Headers_probe_c89>:
push   %rbx
sub    $0x80,%rsp
movaps 0x2cc1(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0x2ca5(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0x2c89(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2c6d(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2c51(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2c35(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c19(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2bfd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <chaz_HeadCheck_check_many_headers@plt>
test   %rax,%rax
je     11f3 <chaz_Headers_probe_c89+0xb3>
lea    0xec4(%rip),%rdi
xor    %esi,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
lea    0xebe(%rip),%rdi
xor    %esi,%esi
call   1040 <chaz_ConfWriter_add_def@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     1231 <chaz_Headers_probe_c89+0xf1>
lea    0x8(%rsp),%rbx
xchg   %ax,%ax
call   1060 <chaz_Headers_keep@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    11e0 <chaz_Headers_probe_c89+0xa0>
jmp    1231 <chaz_Headers_probe_c89+0xf1>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     1231 <chaz_Headers_probe_c89+0xf1>
lea    0x8(%rsp),%rbx
jmp    121c <chaz_Headers_probe_c89+0xdc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     1231 <chaz_Headers_probe_c89+0xf1>
call   1050 <chaz_HeadCheck_check_header@plt>
test   %rax,%rax
je     1210 <chaz_Headers_probe_c89+0xd0>
mov    -0x8(%rbx),%rdi
call   1060 <chaz_Headers_keep@plt>
jmp    1210 <chaz_Headers_probe_c89+0xd0>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"assert.h\00"
@.str.1 = [8 x i8] c"ctype.h\00"
@.str.2 = [8 x i8] c"errno.h\00"
@.str.3 = [8 x i8] c"float.h\00"
@.str.4 = [9 x i8] c"limits.h\00"
@.str.5 = [9 x i8] c"locale.h\00"
@.str.6 = [7 x i8] c"math.h\00"
@.str.7 = [9 x i8] c"setjmp.h\00"
@.str.8 = [9 x i8] c"signal.h\00"
@.str.9 = [9 x i8] c"stdarg.h\00"
@.str.10 = [9 x i8] c"stddef.h\00"
@.str.11 = [8 x i8] c"stdio.h\00"
@.str.12 = [9 x i8] c"stdlib.h\00"
@.str.13 = [9 x i8] c"string.h\00"
@.str.14 = [7 x i8] c"time.h\00"
@__const.chaz_Headers_probe_c89.c89_headers = [16 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* null]
@.str.15 = [8 x i8] c"HAS_C89\00"
@.str.16 = [8 x i8] c"HAS_C90\00"
define void @chaz_Headers_probe_c89() {
%1 = alloca [16 x i8*]
%2 = alloca i32
%3 = bitcast [16 x i8*]* %1 to i8*
%4 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 0
%5 = call i64 @chaz_HeadCheck_check_many_headers(i8** %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %26
7: ; preds = %0
%8 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i32* null)
%9 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32* null)
store i32 0, i32* %2
br label %10
10: ; preds = %22, %7
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %25
16: ; preds = %10
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @chaz_Headers_keep(i8* %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %10
25: ; preds = %10
br label %51
26: ; preds = %0
store i32 0, i32* %2
br label %27
27: ; preds = %47, %26
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 %29
%31 = load i8*, i8** %30
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %50
33: ; preds = %27
%34 = load i32, i32* %2
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 %35
%37 = load i8*, i8** %36
%38 = call i64 @chaz_HeadCheck_check_header(i8* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %33
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @chaz_Headers_keep(i8* %44)
br label %46
46: ; preds = %40, %33
br label %47
47: ; preds = %46
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %27
50: ; preds = %27
br label %51
51: ; preds = %50, %25
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"assert.h\00"
@.str.1 = [8 x i8] c"ctype.h\00"
@.str.2 = [8 x i8] c"errno.h\00"
@.str.3 = [8 x i8] c"float.h\00"
@.str.4 = [9 x i8] c"limits.h\00"
@.str.5 = [9 x i8] c"locale.h\00"
@.str.6 = [7 x i8] c"math.h\00"
@.str.7 = [9 x i8] c"setjmp.h\00"
@.str.8 = [9 x i8] c"signal.h\00"
@.str.9 = [9 x i8] c"stdarg.h\00"
@.str.10 = [9 x i8] c"stddef.h\00"
@.str.11 = [8 x i8] c"stdio.h\00"
@.str.12 = [9 x i8] c"stdlib.h\00"
@.str.13 = [9 x i8] c"string.h\00"
@.str.14 = [7 x i8] c"time.h\00"
@__const.chaz_Headers_probe_c89.c89_headers = [16 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* null]
@.str.15 = [8 x i8] c"HAS_C89\00"
@.str.16 = [8 x i8] c"HAS_C90\00"
define void @chaz_Headers_probe_c89() {
%1 = alloca [16 x i8*]
%2 = bitcast [16 x i8*]* %1 to i8*
%3 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 0
%4 = call i64 @chaz_HeadCheck_check_many_headers(i8** %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %36, label %22
9: ; preds = %0
%10 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i32* null)
%11 = call i32 @chaz_ConfWriter_add_def(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32* null)
%12 = load i8*, i8** %3
%13 = icmp eq i8* %12, null
br i1 %13, label %36, label %14
14: ; preds = %9, %14
%15 = phi i64 [ %18, %14 ], [ 0, %9 ]
%16 = phi i8* [ %20, %14 ], [ %12, %9 ]
%17 = call i32 @chaz_Headers_keep(i8* %16)
%18 = add nuw i64 %15, 1
%19 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %36, label %14
22: ; preds = %6, %31
%23 = phi i64 [ %32, %31 ], [ 0, %6 ]
%24 = phi i8* [ %34, %31 ], [ %7, %6 ]
%25 = phi i8** [ %33, %31 ], [ %3, %6 ]
%26 = call i64 @chaz_HeadCheck_check_header(i8* %24)
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %22
%29 = load i8*, i8** %25
%30 = call i32 @chaz_Headers_keep(i8* %29)
br label %31
31: ; preds = %22, %28
%32 = add nuw i64 %23, 1
%33 = getelementptr inbounds [16 x i8*], [16 x i8*]* %1, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %22
36: ; preds = %14, %31, %9, %6
ret void
}