#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ fclose(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *stderr;
void output_predicate_test(const char *filename,
                           bool (*predicate)(unsigned int),
                           const char *expression) {
  FILE *stream;
  bool need_comma;
  unsigned int ch;
  stream = fopen(filename, "w");
  if (stream == NULL) {
    fprintf(stderr, "cannot open '%s' for writing\n", filename);
    exit(1);
  }
  fprintf(stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
  fprintf(stream, "/* Test the Unicode character type functions.\n");
  fprintf(stream, "   Copyright (C) 2007 Free Software Foundation, Inc.\n");
  fprintf(stream, "\n");
  fprintf(stream, "   This program is free software: you can redistribute it "
                  "and/or modify\n");
  fprintf(stream, "   it under the terms of the GNU General Public License as "
                  "published by\n");
  fprintf(
      stream,
      "   the Free Software Foundation; either version 3 of the License, or\n");
  fprintf(stream, "   (at your option) any later version.\n");
  fprintf(stream, "\n");
  fprintf(
      stream,
      "   This program is distributed in the hope that it will be useful,\n");
  fprintf(
      stream,
      "   but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
  fprintf(stream,
          "   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n");
  fprintf(stream, "   GNU General Public License for more details.\n");
  fprintf(stream, "\n");
  fprintf(
      stream,
      "   You should have received a copy of the GNU General Public License\n");
  fprintf(stream, "   along with this program.  If not, see "
                  "<http://www.gnu.org/licenses/>.  */\n");
  fprintf(stream, "\n");
  fprintf(stream, "#include \"test-predicate-part1.h\"\n");
  fprintf(stream, "\n");
  need_comma = false;
  for (ch = 0; ch < 0x110000; ch++)
    if (predicate(ch)) {
      unsigned int first = ch;
      unsigned int last;
      while (ch + 1 < 0x110000 && predicate(ch + 1))
        ch++;
      last = ch;
      if (need_comma)
        fprintf(stream, ",\n");
      fprintf(stream, "    { 0x%04X, 0x%04X }", first, last);
      need_comma = true;
    }
  if (need_comma)
    fprintf(stream, "\n");
  fprintf(stream, "\n");
  fprintf(stream, "#define PREDICATE(c) %s\n", expression);
  fprintf(stream, "#include \"test-predicate-part2.h\"\n");
  if (ferror(stream) || fclose(stream)) {
    fprintf(stderr, "error writing to '%s'\n", filename);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<output_predicate_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11a9 <output_predicate_test+0x59>
mov    0x2e56(%rip),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1177(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xeed(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf24(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf58(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x111d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf5c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf8e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xfbf(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xfef(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x10c3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xffc(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1030(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x108d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x105a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0x1069(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x110000,-0x28(%rbp)
jae    13d0 <output_predicate_test+0x280>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%edi
call   *%rax
cmp    $0x0,%eax
je     13bd <output_predicate_test+0x26d>
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
xor    %eax,%eax
cmp    $0x110000,%ecx
mov    %al,-0x31(%rbp)
jae    135e <output_predicate_test+0x20e>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%edi
add    $0x1,%edi
call   *%rax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    136e <output_predicate_test+0x21e>
jmp    137c <output_predicate_test+0x22c>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1332 <output_predicate_test+0x1e2>
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     139e <output_predicate_test+0x24e>
mov    -0x20(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
lea    0xfb4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
jmp    13c2 <output_predicate_test+0x272>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    130d <output_predicate_test+0x1bd>
cmpl   $0x0,-0x24(%rbp)
je     13ec <output_predicate_test+0x29c>
mov    -0x20(%rbp),%rdi
lea    0xf7c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf6a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xf6d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xf74(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
jne    144c <output_predicate_test+0x2fc>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     1472 <output_predicate_test+0x322>
mov    0x2b8d(%rip),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xf55(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_predicate_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
lea    0xe75(%rip),%rsi
mov    %rdi,0x8(%rsp)
call   1070 <fopen@plt>
test   %rax,%rax
je     1495 <output_predicate_test+0x325>
mov    %rax,%r12
lea    0xe78(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xe8c(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xea2(%rip),%rdi
mov    $0x35,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    0xeb2(%rip),%rdi
mov    $0x48,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xee2(%rip),%rdi
mov    $0x48,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf12(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf3f(%rip),%rdi
mov    $0x27,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    0xf41(%rip),%rdi
mov    $0x43,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf6c(%rip),%rdi
mov    $0x42,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf96(%rip),%rdi
mov    $0x41,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xfbf(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    0xfca(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xff7(%rip),%rdi
mov    $0x4d,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    0x101f(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
xor    %r14d,%r14d
mov    $0x1,%bpl
mov    %ebp,0x4(%rsp)
lea    0x1(%r14),%ebp
xchg   %ax,%ax
mov    %r14d,%edi
call   *%rbx
test   %eax,%eax
jne    1380 <output_predicate_test+0x210>
lea    0x1(%r14),%eax
add    $0x1,%ebp
cmp    $0x10ffff,%r14d
mov    %eax,%r14d
jb     1350 <output_predicate_test+0x1e0>
jmp    140b <output_predicate_test+0x29b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,0x10(%rsp)
cmp    $0x110000,%r14d
mov    $0x10ffff,%r13d
cmovae %r14d,%r13d
mov    %r13d,%r15d
neg    %r15d
nopl   0x0(%rax)
lea    (%r15,%rbp,1),%eax
cmp    $0x1,%eax
je     13ba <output_predicate_test+0x24a>
mov    %ebp,%edi
call   *%rbx
add    $0x1,%ebp
test   %eax,%eax
jne    13a0 <output_predicate_test+0x230>
add    $0xfffffffe,%ebp
mov    %ebp,%r13d
testb  $0x1,0x4(%rsp)
mov    0x10(%rsp),%r15
jne    13df <output_predicate_test+0x26f>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe1c(%rip),%rdi
mov    %r12,%rcx
call   1090 <fwrite@plt>
xor    %ebp,%ebp
mov    %r12,%rdi
lea    0xf78(%rip),%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0x1(%r13),%r14d
cmp    $0x10ffff,%r13d
jb     1346 <output_predicate_test+0x1d6>
jmp    1412 <output_predicate_test+0x2a2>
testb  $0x1,0x4(%rsp)
jne    141f <output_predicate_test+0x2af>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    0xf47(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xf4c(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    %r12,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    1482 <output_predicate_test+0x312>
mov    %r12,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    1482 <output_predicate_test+0x312>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b57(%rip),%rax
mov    (%rax),%rdi
lea    0xf23(%rip),%rsi
jmp    14a6 <output_predicate_test+0x336>
mov    0x2b44(%rip),%rax
mov    (%rax),%rdi
lea    0xb5c(%rip),%rsi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@stderr = global i32* null
@.str.1 = [30 x i8] c"cannot open '%s' for writing\0A\00"
@.str.2 = [45 x i8] c"/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\0A\00"
@.str.3 = [47 x i8] c"/* Test the Unicode character type functions.\0A\00"
@.str.4 = [54 x i8] c" Copyright (C) 2007 Free Software Foundation, Inc.\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [73 x i8] c" This program is free software: you can redistribute it and/or modify\0A\00"
@.str.7 = [73 x i8] c" it under the terms of the GNU General Public License as published by\0A\00"
@.str.8 = [70 x i8] c" the Free Software Foundation; either version 3 of the License, or\0A\00"
@.str.9 = [40 x i8] c" (at your option) any later version.\0A\00"
@.str.10 = [68 x i8] c" This program is distributed in the hope that it will be useful,\0A\00"
@.str.11 = [67 x i8] c" but WITHOUT ANY WARRANTY; without even the implied warranty of\0A\00"
@.str.12 = [66 x i8] c" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\0A\00"
@.str.13 = [49 x i8] c" GNU General Public License for more details.\0A\00"
@.str.14 = [70 x i8] c" You should have received a copy of the GNU General Public License\0A\00"
@.str.15 = [78 x i8] c" along with this program. If not, see <http://www.gnu.org/licenses/>. */\0A\00"
@.str.16 = [35 x i8] c"#include \22test-predicate-part1.h\22\0A\00"
@.str.17 = [3 x i8] c",\0A\00"
@.str.18 = [23 x i8] c" { 0x%04X, 0x%04X }\00"
@.str.19 = [25 x i8] c"#define PREDICATE(c) %s\0A\00"
@.str.20 = [35 x i8] c"#include \22test-predicate-part2.h\22\0A\00"
@.str.21 = [23 x i8] c"error writing to '%s'\0A\00"
define void @output_predicate_test(i8* %0, i32 (i32)* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32 (i32)*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %4
store i32 (i32)* %1, i32 (i32)** %5
store i8* %2, i8** %6
%12 = load i8*, i8** %4
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %7
%14 = load i32*, i32** %7
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %21
16: ; preds = %3
%17 = load i32*, i32** @stderr
%18 = load i8*, i8** %4
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %3
%22 = load i32*, i32** %7
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32*, i32** %7
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32*, i32** %7
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32*, i32** %7
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%30 = load i32*, i32** %7
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0))
%32 = load i32*, i32** %7
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0))
%34 = load i32*, i32** %7
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0))
%36 = load i32*, i32** %7
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%38 = load i32*, i32** %7
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = load i32*, i32** %7
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.10, i64 0, i64 0))
%42 = load i32*, i32** %7
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0))
%44 = load i32*, i32** %7
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0))
%46 = load i32*, i32** %7
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0))
%48 = load i32*, i32** %7
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%50 = load i32*, i32** %7
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.14, i64 0, i64 0))
%52 = load i32*, i32** %7
%53 = call i32 (i32*, i8*, ...) @fprintf(i32* %52, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.15, i64 0, i64 0))
%54 = load i32*, i32** %7
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%56 = load i32*, i32** %7
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0))
%58 = load i32*, i32** %7
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %8
store i32 0, i32* %9
br label %60
60: ; preds = %98, %21
%61 = load i32, i32* %9
%62 = icmp ult i32 %61, 1114112
br i1 %62, label %63, label %101
63: ; preds = %60
%64 = load i32 (i32)*, i32 (i32)** %5
%65 = load i32, i32* %9
%66 = call i32 %64(i32 %65)
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %97
68: ; preds = %63
%69 = load i32, i32* %9
store i32 %69, i32* %10
br label %70
70: ; preds = %82, %68
%71 = load i32, i32* %9
%72 = add i32 %71, 1
%73 = icmp ult i32 %72, 1114112
br i1 %73, label %74, label %80
74: ; preds = %70
%75 = load i32 (i32)*, i32 (i32)** %5
%76 = load i32, i32* %9
%77 = add i32 %76, 1
%78 = call i32 %75(i32 %77)
%79 = icmp ne i32 %78, 0
br label %80
80: ; preds = %74, %70
%81 = phi i1 [ false, %70 ], [ %79, %74 ]
br i1 %81, label %82, label %85
82: ; preds = %80
%83 = load i32, i32* %9
%84 = add i32 %83, 1
store i32 %84, i32* %9
br label %70
85: ; preds = %80
%86 = load i32, i32* %9
store i32 %86, i32* %11
%87 = load i32, i32* %8
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %92
89: ; preds = %85
%90 = load i32*, i32** %7
%91 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
br label %92
92: ; preds = %89, %85
%93 = load i32*, i32** %7
%94 = load i32, i32* %10
%95 = load i32, i32* %11
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i32 %94, i32 %95)
store i32 1, i32* %8
br label %97
97: ; preds = %92, %63
br label %98
98: ; preds = %97
%99 = load i32, i32* %9
%100 = add i32 %99, 1
store i32 %100, i32* %9
br label %60
101: ; preds = %60
%102 = load i32, i32* %8
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %107
104: ; preds = %101
%105 = load i32*, i32** %7
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %107
107: ; preds = %104, %101
%108 = load i32*, i32** %7
%109 = call i32 (i32*, i8*, ...) @fprintf(i32* %108, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%110 = load i32*, i32** %7
%111 = load i8*, i8** %6
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.19, i64 0, i64 0), i8* %111)
%113 = load i32*, i32** %7
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.20, i64 0, i64 0))
%115 = load i32*, i32** %7
%116 = call i64 @ferror(i32* %115)
%117 = icmp ne i64 %116, 0
br i1 %117, label %122, label %118
118: ; preds = %107
%119 = load i32*, i32** %7
%120 = call i64 @fclose(i32* %119)
%121 = icmp ne i64 %120, 0
br i1 %121, label %122, label %127
122: ; preds = %118, %107
%123 = load i32*, i32** @stderr
%124 = load i8*, i8** %4
%125 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0), i8* %124)
%126 = call i32 @exit(i32 1)
unreachable
127: ; preds = %118
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@stderr = global i32* null
@.str.1 = [30 x i8] c"cannot open '%s' for writing\0A\00"
@.str.2 = [45 x i8] c"/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\0A\00"
@.str.3 = [47 x i8] c"/* Test the Unicode character type functions.\0A\00"
@.str.4 = [54 x i8] c" Copyright (C) 2007 Free Software Foundation, Inc.\0A\00"
@.str.6 = [73 x i8] c" This program is free software: you can redistribute it and/or modify\0A\00"
@.str.7 = [73 x i8] c" it under the terms of the GNU General Public License as published by\0A\00"
@.str.8 = [70 x i8] c" the Free Software Foundation; either version 3 of the License, or\0A\00"
@.str.9 = [40 x i8] c" (at your option) any later version.\0A\00"
@.str.10 = [68 x i8] c" This program is distributed in the hope that it will be useful,\0A\00"
@.str.11 = [67 x i8] c" but WITHOUT ANY WARRANTY; without even the implied warranty of\0A\00"
@.str.12 = [66 x i8] c" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\0A\00"
@.str.13 = [49 x i8] c" GNU General Public License for more details.\0A\00"
@.str.14 = [70 x i8] c" You should have received a copy of the GNU General Public License\0A\00"
@.str.15 = [78 x i8] c" along with this program. If not, see <http://www.gnu.org/licenses/>. */\0A\00"
@.str.16 = [35 x i8] c"#include \22test-predicate-part1.h\22\0A\00"
@.str.17 = [3 x i8] c",\0A\00"
@.str.18 = [23 x i8] c" { 0x%04X, 0x%04X }\00"
@.str.19 = [25 x i8] c"#define PREDICATE(c) %s\0A\00"
@.str.20 = [35 x i8] c"#include \22test-predicate-part2.h\22\0A\00"
@.str.21 = [23 x i8] c"error writing to '%s'\0A\00"
define void @output_predicate_test(i8* %0, i32 (i32)* nocapture %1, i8* %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32*, i32** @stderr
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i64 44, i64 1, i32* %4)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i64 46, i64 1, i32* %4)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i64 53, i64 1, i32* %4)
%14 = tail call i32 @fputc(i32 10, i32* %4)
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0), i64 72, i64 1, i32* %4)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0), i64 72, i64 1, i32* %4)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0), i64 69, i64 1, i32* %4)
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i64 39, i64 1, i32* %4)
%19 = tail call i32 @fputc(i32 10, i32* %4)
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.10, i64 0, i64 0), i64 67, i64 1, i32* %4)
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0), i64 66, i64 1, i32* %4)
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0), i64 65, i64 1, i32* %4)
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0), i64 48, i64 1, i32* %4)
%24 = tail call i32 @fputc(i32 10, i32* %4)
%25 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.14, i64 0, i64 0), i64 69, i64 1, i32* %4)
%26 = tail call i64 @fwrite(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.15, i64 0, i64 0), i64 77, i64 1, i32* %4)
%27 = tail call i32 @fputc(i32 10, i32* %4)
%28 = tail call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0), i64 34, i64 1, i32* %4)
%29 = tail call i32 @fputc(i32 10, i32* %4)
br label %30
30: ; preds = %53, %10
%31 = phi i1 [ false, %53 ], [ true, %10 ]
%32 = phi i32 [ %55, %53 ], [ 0, %10 ]
br label %33
33: ; preds = %30, %50
%34 = phi i32 [ %51, %50 ], [ %32, %30 ]
%35 = tail call i32 %1(i32 %34)
%36 = icmp eq i32 %35, 0
br i1 %36, label %50, label %37
37: ; preds = %33
%38 = call i32 @llvm.umax.i32(i32 %34, i32 1114111)
br label %39
39: ; preds = %37, %43
%40 = phi i32 [ %41, %43 ], [ %34, %37 ]
%41 = add i32 %40, 1
%42 = icmp eq i32 %40, %38
br i1 %42, label %46, label %43
43: ; preds = %39
%44 = tail call i32 %1(i32 %41)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %39
46: ; preds = %39, %43
%47 = phi i32 [ %38, %39 ], [ %40, %43 ]
br i1 %31, label %53, label %48
48: ; preds = %46
%49 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i64 2, i64 1, i32* %4)
br label %53
50: ; preds = %33
%51 = add nuw nsw i32 %34, 1
%52 = icmp ult i32 %34, 1114111
br i1 %52, label %33, label %57
53: ; preds = %46, %48
%54 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i32 %34, i32 %47)
%55 = add nuw nsw i32 %47, 1
%56 = icmp ult i32 %47, 1114111
br i1 %56, label %30, label %58
57: ; preds = %50
br i1 %31, label %60, label %58
58: ; preds = %53, %57
%59 = tail call i32 @fputc(i32 10, i32* %4)
br label %60
60: ; preds = %58, %57
%61 = tail call i32 @fputc(i32 10, i32* %4)
%62 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.19, i64 0, i64 0), i8* %2)
%63 = tail call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.20, i64 0, i64 0), i64 34, i64 1, i32* %4)
%64 = tail call i64 @ferror(i32* %4)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %60
%67 = tail call i64 @fclose(i32* %4)
%68 = icmp eq i64 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %66, %60
%70 = load i32*, i32** @stderr
%71 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0), i8* %0)
%72 = tail call i32 @exit(i32 1)
unreachable
73: ; preds = %66
ret void
}