#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 */
char *chaz_CC_capture_output(char const *, size_t *);
int /*<<< orphan*/ free(char *);
scalar_t__ strncmp(char *, char *, int);
int chaz_FuncMacro_probe_iso() {
  static const char iso_func_code[] = "#include <stdio.h>"
                                      "\n"
                                      "int main() {"
                                      "\n"
                                      "printf(\"%s\", __func__);"
                                      "\n"
                                      "return 0;"
                                      "\n"
                                      "}"
                                      "\n";
  size_t output_len;
  char *output;
  int success = 0;
  output = chaz_CC_capture_output(iso_func_code, &output_len);
  if (output != NULL && strncmp(output, "main", 4) == 0) {
    success = 1;
  }
  free(output);
  return success;
}


x86 assembly (clang, -O0):
<chaz_FuncMacro_probe_iso>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <chaz_CC_capture_output@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1184 <chaz_FuncMacro_probe_iso+0x54>
mov    -0x10(%rbp),%rdi
lea    0xedc(%rip),%rsi
mov    $0x4,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
jne    1184 <chaz_FuncMacro_probe_iso+0x54>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaz_FuncMacro_probe_iso>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
mov    %rsp,%rsi
call   1040 <chaz_CC_capture_output@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1169 <chaz_FuncMacro_probe_iso+0x39>
lea    0xef4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <strncmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
jmp    116b <chaz_FuncMacro_probe_iso+0x3b>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@chaz_FuncMacro_probe_iso.iso_func_code = internal constant [69 x i8] c"#include <stdio.h>\0Aint main() {\0Aprintf(\22%s\22, __func__);\0Areturn 0;\0A}\0A\00"
@.str = [5 x i8] c"main\00"
define i32 @chaz_FuncMacro_probe_iso() {
%1 = alloca i64
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %3
%4 = call i8* @chaz_CC_capture_output(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @chaz_FuncMacro_probe_iso.iso_func_code, i64 0, i64 0), i64* %1)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %3
br label %12
12: ; preds = %11, %7, %0
%13 = load i8*, i8** %2
%14 = call i32 @free(i8* %13)
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@chaz_FuncMacro_probe_iso.iso_func_code = internal constant [69 x i8] c"#include <stdio.h>\0Aint main() {\0Aprintf(\22%s\22, __func__);\0Areturn 0;\0A}\0A\00"
@.str = [5 x i8] c"main\00"
define i32 @chaz_FuncMacro_probe_iso() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i8* @chaz_CC_capture_output(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @chaz_FuncMacro_probe_iso.iso_func_code, i64 0, i64 0), i64* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %0
%10 = phi i32 [ 0, %0 ], [ %8, %5 ]
%11 = call i32 @free(i8* %3)
ret i32 %10
}