#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*/ UNormalizationMode;
typedef int UChar32;

/* Variables and functions */
int /*<<< orphan*/ U_IS_UNICODE_CHAR(int);
scalar_t__ normalize(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ ucs2utf(int, unsigned char *);
void dump(UNormalizationMode mode) {
  UChar32 ch;
  char str[7], norm[0x100];
  for (ch = 1; ch < 0x110000; ch++) {
    if (!U_IS_UNICODE_CHAR(ch)) {
      continue;
    }
    ucs2utf(ch, (unsigned char *)str);
    if (normalize(str, norm, mode)) {
      printf("ch=%04x error occure\n", ch);
      continue;
    }
    if (strcmp(norm, str)) {
      printf("%04x\t%s\t%s\n", ch, str, norm);
    }
  }
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x110000,-0x8(%rbp)
jge    1210 <dump+0xc0>
mov    -0x8(%rbp),%edi
call   1070 <U_IS_UNICODE_CHAR@plt>
cmp    $0x0,%eax
jne    1188 <dump+0x38>
jmp    1202 <dump+0xb2>
mov    -0x8(%rbp),%edi
lea    -0xf(%rbp),%rsi
call   1030 <ucs2utf@plt>
lea    -0xf(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1050 <normalize@plt>
cmp    $0x0,%rax
je     11c7 <dump+0x77>
mov    -0x8(%rbp),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1202 <dump+0xb2>
lea    -0x110(%rbp),%rdi
lea    -0xf(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11fd <dump+0xad>
mov    -0x8(%rbp),%esi
lea    -0xf(%rbp),%rdx
lea    -0x110(%rbp),%rcx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1202 <dump+0xb2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <dump+0x15>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %edi,%r14d
mov    $0x1,%ebp
lea    0x9(%rsp),%rbx
lea    0x10(%rsp),%r15
lea    0xe9c(%rip),%r12
lea    0xe7f(%rip),%r13
jmp    11a7 <dump+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x110000,%ebp
je     11f3 <dump+0xa3>
mov    %ebp,%edi
call   1070 <U_IS_UNICODE_CHAR@plt>
test   %eax,%eax
je     119c <dump+0x4c>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <ucs2utf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1050 <normalize@plt>
test   %rax,%rax
jne    1190 <dump+0x40>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     119c <dump+0x4c>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    119c <dump+0x4c>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"ch=%04x error occure\0A\00"
@.str.1 = [12 x i8] c"%04x\09%s\09%s\0A\00"
define void @dump(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [7 x i8]
%5 = alloca [256 x i8]
store i32 %0, i32* %2
store i32 1, i32* %3
br label %6
6: ; preds = %37, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1114112
br i1 %8, label %9, label %40
9: ; preds = %6
%10 = load i32, i32* %3
%11 = call i32 @U_IS_UNICODE_CHAR(i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
br label %37
14: ; preds = %9
%15 = load i32, i32* %3
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%17 = call i32 @ucs2utf(i32 %15, i8* %16)
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%20 = load i32, i32* %2
%21 = call i64 @normalize(i8* %18, i8* %19, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %14
%24 = load i32, i32* %3
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %37
26: ; preds = %14
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%29 = call i64 @strcmp(i8* %27, i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = load i32, i32* %3
%33 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %32, i8* %33, i8* %34)
br label %36
36: ; preds = %31, %26
br label %37
37: ; preds = %36, %23, %13
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %6
40: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"ch=%04x error occure\0A\00"
@.str.1 = [12 x i8] c"%04x\09%s\09%s\0A\00"
define void @dump(i32 %0) {
%2 = alloca [7 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
br label %6
6: ; preds = %1, %21
%7 = phi i32 [ 1, %1 ], [ %22, %21 ]
%8 = call i32 @U_IS_UNICODE_CHAR(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %21, label %10
10: ; preds = %6
%11 = call i32 @ucs2utf(i32 %7, i8* %4)
%12 = call i64 @normalize(i8* %4, i8* %5, i32 %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %21
16: ; preds = %10
%17 = call i64 @strcmp(i8* %5, i8* %4)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %7, i8* %4, i8* %5)
br label %21
21: ; preds = %16, %19, %6, %14
%22 = add nuw nsw i32 %7, 1
%23 = icmp eq i32 %22, 1114112
br i1 %23, label %24, label %6
24: ; preds = %21
ret void
}