#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_simple_mapping_test(const char *filename, const char *function_name,
                                unsigned int (*func)(unsigned int),
                                const char *version) {
  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 mapping functions.\n");
  fprintf(stream, "   Copyright (C) 2009 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,
      "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
      version);
  fprintf(stream, "\n");
  fprintf(stream, "#include \"test-mapping-part1.h\"\n");
  fprintf(stream, "\n");
  need_comma = false;
  for (ch = 0; ch < 0x110000; ch++) {
    unsigned int value = func(ch);
    if (value != ch) {
      if (need_comma)
        fprintf(stream, ",\n");
      fprintf(stream, "    { 0x%04X, 0x%04X }", ch, value);
      need_comma = true;
    }
  }
  if (need_comma)
    fprintf(stream, "\n");
  fprintf(stream, "\n");
  fprintf(stream, "#define MAP(c) %s (c)\n", function_name);
  fprintf(stream, "#include \"test-mapping-part2.h\"\n");
  if (ferror(stream) || fclose(stream)) {
    fprintf(stderr, "error writing to '%s'\n", filename);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<output_simple_mapping_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11ad <output_simple_mapping_test+0x5d>
mov    0x2e52(%rip),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x11b8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xf23(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xf57(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x115e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xf5b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xf8d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xfbe(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xfee(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x1104(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xffb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x102f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x10ce(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0x1055(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x10a6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x1075(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0x1082(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x110000,-0x30(%rbp)
jae    13ac <output_simple_mapping_test+0x25c>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%edi
call   *%rax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     1399 <output_simple_mapping_test+0x249>
cmpl   $0x0,-0x2c(%rbp)
je     137a <output_simple_mapping_test+0x22a>
mov    -0x28(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
lea    0x101d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    139e <output_simple_mapping_test+0x24e>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1339 <output_simple_mapping_test+0x1e9>
cmpl   $0x0,-0x2c(%rbp)
je     13c8 <output_simple_mapping_test+0x278>
mov    -0x28(%rbp),%rdi
lea    0xfe5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xfd3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xfd6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xfdb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
jne    1428 <output_simple_mapping_test+0x2d8>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     144e <output_simple_mapping_test+0x2fe>
mov    0x2bb1(%rip),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xfba(%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_simple_mapping_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,0x10(%rsp)
lea    0xe70(%rip),%rsi
mov    %rdi,0x8(%rsp)
call   1070 <fopen@plt>
test   %rax,%rax
je     1466 <output_simple_mapping_test+0x2f6>
mov    %rax,%r12
lea    0xe73(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xe87(%rip),%rdi
mov    $0x31,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xea0(%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    0xeb0(%rip),%rdi
mov    $0x48,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xee0(%rip),%rdi
mov    $0x48,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf10(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf3d(%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    0xf3f(%rip),%rdi
mov    $0x43,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf6a(%rip),%rdi
mov    $0x42,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xf94(%rip),%rdi
mov    $0x41,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xfbd(%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    0xfc8(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
lea    0xff5(%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    0x101d(%rip),%rsi
xor    %ebp,%ebp
mov    %r12,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    0x103e(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
mov    $0x1,%r13b
mov    %ebp,%r14d
xchg   %ax,%ax
mov    %r14d,%edi
call   *%rbx
cmp    %eax,%r14d
jne    1390 <output_simple_mapping_test+0x220>
add    $0x1,%r14d
cmp    $0x110000,%r14d
jne    1370 <output_simple_mapping_test+0x200>
jmp    13db <output_simple_mapping_test+0x26b>
nopl   0x0(%rax)
mov    %eax,%r15d
test   $0x1,%r13b
jne    13b2 <output_simple_mapping_test+0x242>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe4c(%rip),%rdi
mov    %r12,%rcx
call   1090 <fwrite@plt>
xor    %r13d,%r13d
mov    %r12,%rdi
lea    0xfe9(%rip),%rsi
mov    %r14d,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0x1(%r14),%ebp
cmp    $0x10ffff,%r14d
jne    136b <output_simple_mapping_test+0x1fb>
jmp    13e1 <output_simple_mapping_test+0x271>
test   $0x1,%r13b
jne    13ee <output_simple_mapping_test+0x27e>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1050 <fputc@plt>
lea    0xfbd(%rip),%rsi
mov    %r12,%rdi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xfbe(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
mov    %r12,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    1453 <output_simple_mapping_test+0x2e3>
mov    %r12,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    1453 <output_simple_mapping_test+0x2e3>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b86(%rip),%rax
mov    (%rax),%rdi
lea    0xf93(%rip),%rsi
jmp    1477 <output_simple_mapping_test+0x307>
mov    0x2b73(%rip),%rax
mov    (%rax),%rdi
lea    0xb8b(%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 = [50 x i8] c"/* Test the Unicode character mapping functions.\0A\00"
@.str.4 = [54 x i8] c" Copyright (C) 2009 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 = [68 x i8] c"/* Generated automatically by gen-uni-tables.c for Unicode %s. */\0A\00"
@.str.17 = [33 x i8] c"#include \22test-mapping-part1.h\22\0A\00"
@.str.18 = [3 x i8] c",\0A\00"
@.str.19 = [23 x i8] c" { 0x%04X, 0x%04X }\00"
@.str.20 = [23 x i8] c"#define MAP(c) %s (c)\0A\00"
@.str.21 = [33 x i8] c"#include \22test-mapping-part2.h\22\0A\00"
@.str.22 = [23 x i8] c"error writing to '%s'\0A\00"
define void @output_simple_mapping_test(i8* %0, i8* %1, i32 (i32)* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32 (i32)*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 (i32)* %2, i32 (i32)** %7
store i8* %3, i8** %8
%13 = load i8*, i8** %5
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %9
%15 = load i32*, i32** %9
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %22
17: ; preds = %4
%18 = load i32*, i32** @stderr
%19 = load i8*, i8** %5
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %4
%23 = load i32*, i32** %9
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32*, i32** %9
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32*, i32** %9
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%29 = load i32*, i32** %9
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%31 = load i32*, i32** %9
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0))
%33 = load i32*, i32** %9
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0))
%35 = load i32*, i32** %9
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0))
%37 = load i32*, i32** %9
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%39 = load i32*, i32** %9
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%41 = load i32*, i32** %9
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.10, i64 0, i64 0))
%43 = load i32*, i32** %9
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0))
%45 = load i32*, i32** %9
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0))
%47 = load i32*, i32** %9
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0))
%49 = load i32*, i32** %9
%50 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%51 = load i32*, i32** %9
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.14, i64 0, i64 0))
%53 = load i32*, i32** %9
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.15, i64 0, i64 0))
%55 = load i32*, i32** %9
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%57 = load i32*, i32** %9
%58 = load i8*, i8** %8
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.16, i64 0, i64 0), i8* %58)
%60 = load i32*, i32** %9
%61 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%62 = load i32*, i32** %9
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %62, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0))
%64 = load i32*, i32** %9
%65 = call i32 (i32*, i8*, ...) @fprintf(i32* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %10
store i32 0, i32* %11
br label %66
66: ; preds = %88, %22
%67 = load i32, i32* %11
%68 = icmp ult i32 %67, 1114112
br i1 %68, label %69, label %91
69: ; preds = %66
%70 = load i32 (i32)*, i32 (i32)** %7
%71 = load i32, i32* %11
%72 = call i32 %70(i32 %71)
store i32 %72, i32* %12
%73 = load i32, i32* %12
%74 = load i32, i32* %11
%75 = icmp ne i32 %73, %74
br i1 %75, label %76, label %87
76: ; preds = %69
%77 = load i32, i32* %10
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %76
%80 = load i32*, i32** %9
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i64 0, i64 0))
br label %82
82: ; preds = %79, %76
%83 = load i32*, i32** %9
%84 = load i32, i32* %11
%85 = load i32, i32* %12
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %83, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i32 %84, i32 %85)
store i32 1, i32* %10
br label %87
87: ; preds = %82, %69
br label %88
88: ; preds = %87
%89 = load i32, i32* %11
%90 = add i32 %89, 1
store i32 %90, i32* %11
br label %66
91: ; preds = %66
%92 = load i32, i32* %10
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %91
%95 = load i32*, i32** %9
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %97
97: ; preds = %94, %91
%98 = load i32*, i32** %9
%99 = call i32 (i32*, i8*, ...) @fprintf(i32* %98, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%100 = load i32*, i32** %9
%101 = load i8*, i8** %6
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %100, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.20, i64 0, i64 0), i8* %101)
%103 = load i32*, i32** %9
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.21, i64 0, i64 0))
%105 = load i32*, i32** %9
%106 = call i64 @ferror(i32* %105)
%107 = icmp ne i64 %106, 0
br i1 %107, label %112, label %108
108: ; preds = %97
%109 = load i32*, i32** %9
%110 = call i64 @fclose(i32* %109)
%111 = icmp ne i64 %110, 0
br i1 %111, label %112, label %117
112: ; preds = %108, %97
%113 = load i32*, i32** @stderr
%114 = load i8*, i8** %5
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.22, i64 0, i64 0), i8* %114)
%116 = call i32 @exit(i32 1)
unreachable
117: ; preds = %108
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 = [50 x i8] c"/* Test the Unicode character mapping functions.\0A\00"
@.str.4 = [54 x i8] c" Copyright (C) 2009 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 = [68 x i8] c"/* Generated automatically by gen-uni-tables.c for Unicode %s. */\0A\00"
@.str.17 = [33 x i8] c"#include \22test-mapping-part1.h\22\0A\00"
@.str.18 = [3 x i8] c",\0A\00"
@.str.19 = [23 x i8] c" { 0x%04X, 0x%04X }\00"
@.str.20 = [23 x i8] c"#define MAP(c) %s (c)\0A\00"
@.str.21 = [33 x i8] c"#include \22test-mapping-part2.h\22\0A\00"
@.str.22 = [23 x i8] c"error writing to '%s'\0A\00"
define void @output_simple_mapping_test(i8* %0, i8* %1, i32 (i32)* nocapture %2, i8* %3) {
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32*, i32** @stderr
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i64 44, i64 1, i32* %5)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i64 49, i64 1, i32* %5)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i64 53, i64 1, i32* %5)
%15 = tail call i32 @fputc(i32 10, i32* %5)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0), i64 72, i64 1, i32* %5)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0), i64 72, i64 1, i32* %5)
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0), i64 69, i64 1, i32* %5)
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i64 39, i64 1, i32* %5)
%20 = tail call i32 @fputc(i32 10, i32* %5)
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.10, i64 0, i64 0), i64 67, i64 1, i32* %5)
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0), i64 66, i64 1, i32* %5)
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0), i64 65, i64 1, i32* %5)
%24 = tail call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0), i64 48, i64 1, i32* %5)
%25 = tail call i32 @fputc(i32 10, i32* %5)
%26 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.14, i64 0, i64 0), i64 69, i64 1, i32* %5)
%27 = tail call i64 @fwrite(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.15, i64 0, i64 0), i64 77, i64 1, i32* %5)
%28 = tail call i32 @fputc(i32 10, i32* %5)
%29 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.16, i64 0, i64 0), i8* %3)
%30 = tail call i32 @fputc(i32 10, i32* %5)
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0), i64 32, i64 1, i32* %5)
%32 = tail call i32 @fputc(i32 10, i32* %5)
br label %33
33: ; preds = %46, %11
%34 = phi i1 [ false, %46 ], [ true, %11 ]
%35 = phi i32 [ %48, %46 ], [ 0, %11 ]
br label %36
36: ; preds = %33, %43
%37 = phi i32 [ %44, %43 ], [ %35, %33 ]
%38 = tail call i32 %2(i32 %37)
%39 = icmp eq i32 %38, %37
br i1 %39, label %43, label %40
40: ; preds = %36
br i1 %34, label %46, label %41
41: ; preds = %40
%42 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i64 0, i64 0), i64 2, i64 1, i32* %5)
br label %46
43: ; preds = %36
%44 = add nuw nsw i32 %37, 1
%45 = icmp eq i32 %44, 1114112
br i1 %45, label %50, label %36
46: ; preds = %40, %41
%47 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i32 %37, i32 %38)
%48 = add nuw nsw i32 %37, 1
%49 = icmp eq i32 %48, 1114112
br i1 %49, label %51, label %33
50: ; preds = %43
br i1 %34, label %53, label %51
51: ; preds = %46, %50
%52 = tail call i32 @fputc(i32 10, i32* %5)
br label %53
53: ; preds = %51, %50
%54 = tail call i32 @fputc(i32 10, i32* %5)
%55 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.20, i64 0, i64 0), i8* %1)
%56 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.21, i64 0, i64 0), i64 32, i64 1, i32* %5)
%57 = tail call i64 @ferror(i32* %5)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %53
%60 = tail call i64 @fclose(i32* %5)
%61 = icmp eq i64 %60, 0
br i1 %61, label %66, label %62
62: ; preds = %59, %53
%63 = load i32*, i32** @stderr
%64 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.22, i64 0, i64 0), i8* %0)
%65 = tail call i32 @exit(i32 1)
unreachable
66: ; preds = %59
ret void
}