#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 */
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_win(void) {
  const char *win_headers[] = {"io.h", "windows.h", "process.h", NULL};
  int i;
  if (chaz_HeadCheck_check_many_headers((const char **)win_headers)) {
    for (i = 0; win_headers[i] != NULL; i++) {
      chaz_Headers_keep(win_headers[i]);
    }
  } else {
    for (i = 0; win_headers[i] != NULL; i++) {
      if (chaz_HeadCheck_check_header(win_headers[i])) {
        chaz_Headers_keep(win_headers[i]);
      }
    }
  }
}


x86 assembly (clang, -O0):
<chaz_Headers_probe_win>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2cc1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cbe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cbb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cb8(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <chaz_HeadCheck_check_many_headers@plt>
cmp    $0x0,%rax
je     11af <chaz_Headers_probe_win+0x7f>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmpq   $0x0,-0x20(%rbp,%rax,8)
je     11aa <chaz_Headers_probe_win+0x7a>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rdi
call   1050 <chaz_Headers_keep@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117e <chaz_Headers_probe_win+0x4e>
jmp    1204 <chaz_Headers_probe_win+0xd4>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmpq   $0x0,-0x20(%rbp,%rax,8)
je     11ff <chaz_Headers_probe_win+0xcf>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rdi
call   1040 <chaz_HeadCheck_check_header@plt>
cmp    $0x0,%rax
je     11ec <chaz_Headers_probe_win+0xbc>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rdi
call   1050 <chaz_Headers_keep@plt>
jmp    11f1 <chaz_Headers_probe_win+0xc1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b6 <chaz_Headers_probe_win+0x86>
jmp    1204 <chaz_Headers_probe_win+0xd4>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaz_Headers_probe_win>:
push   %rbx
sub    $0x20,%rsp
movaps 0x2cd4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2cb8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <chaz_HeadCheck_check_many_headers@plt>
mov    (%rsp),%rdi
test   %rax,%rax
je     1183 <chaz_Headers_probe_win+0x53>
test   %rdi,%rdi
je     11b1 <chaz_Headers_probe_win+0x81>
lea    0x8(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
call   1050 <chaz_Headers_keep@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1170 <chaz_Headers_probe_win+0x40>
jmp    11b1 <chaz_Headers_probe_win+0x81>
test   %rdi,%rdi
je     11b1 <chaz_Headers_probe_win+0x81>
lea    0x8(%rsp),%rbx
jmp    119c <chaz_Headers_probe_win+0x6c>
nop
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     11b1 <chaz_Headers_probe_win+0x81>
call   1040 <chaz_HeadCheck_check_header@plt>
test   %rax,%rax
je     1190 <chaz_Headers_probe_win+0x60>
mov    -0x8(%rbx),%rdi
call   1050 <chaz_Headers_keep@plt>
jmp    1190 <chaz_Headers_probe_win+0x60>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"io.h\00"
@.str.1 = [10 x i8] c"windows.h\00"
@.str.2 = [10 x i8] c"process.h\00"
@__const.chaz_Headers_probe_win.win_headers = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* null]
define void @chaz_Headers_probe_win() {
%1 = alloca [4 x i8*]
%2 = alloca i32
%3 = bitcast [4 x i8*]* %1 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 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 %24
7: ; preds = %0
store i32 0, i32* %2
br label %8
8: ; preds = %20, %7
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %23
14: ; preds = %8
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @chaz_Headers_keep(i8* %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %8
23: ; preds = %8
br label %49
24: ; preds = %0
store i32 0, i32* %2
br label %25
25: ; preds = %45, %24
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %48
31: ; preds = %25
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 %33
%35 = load i8*, i8** %34
%36 = call i64 @chaz_HeadCheck_check_header(i8* %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %31
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @chaz_Headers_keep(i8* %42)
br label %44
44: ; preds = %38, %31
br label %45
45: ; preds = %44
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %25
48: ; preds = %25
br label %49
49: ; preds = %48, %23
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"io.h\00"
@.str.1 = [10 x i8] c"windows.h\00"
@.str.2 = [10 x i8] c"process.h\00"
@__const.chaz_Headers_probe_win.win_headers = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* null]
define void @chaz_Headers_probe_win() {
%1 = alloca [4 x i8*]
%2 = bitcast [4 x i8*]* %1 to i8*
%3 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%4 = call i64 @chaz_HeadCheck_check_many_headers(i8** %3)
%5 = icmp eq i64 %4, 0
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %5, label %9, label %8
8: ; preds = %0
br i1 %7, label %32, label %10
9: ; preds = %0
br i1 %7, label %32, label %18
10: ; preds = %8, %10
%11 = phi i64 [ %14, %10 ], [ 0, %8 ]
%12 = phi i8* [ %16, %10 ], [ %6, %8 ]
%13 = call i32 @chaz_Headers_keep(i8* %12)
%14 = add nuw i64 %11, 1
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %32, label %10
18: ; preds = %9, %27
%19 = phi i64 [ %28, %27 ], [ 0, %9 ]
%20 = phi i8* [ %30, %27 ], [ %6, %9 ]
%21 = phi i8** [ %29, %27 ], [ %3, %9 ]
%22 = call i64 @chaz_HeadCheck_check_header(i8* %20)
%23 = icmp eq i64 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %18
%25 = load i8*, i8** %21
%26 = call i32 @chaz_Headers_keep(i8* %25)
br label %27
27: ; preds = %18, %24
%28 = add nuw i64 %19, 1
%29 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 %28
%30 = load i8*, i8** %29
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %18
32: ; preds = %10, %27, %8, %9
ret void
}