#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 UChar32;

/* Variables and functions */
int /*<<< orphan*/ UNORM_NFC;
int /*<<< orphan*/ UNORM_NFD;
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 ccdump(void) {
  UChar32 ch;
  char str[7], nfd[0x100], nfc[0x100];
  for (ch = 1; ch < 0x110000; ch++) {
    if (!U_IS_UNICODE_CHAR(ch)) {
      continue;
    }
    ucs2utf(ch, (unsigned char *)str);
    if (normalize(str, nfd, UNORM_NFD)) {
      printf("ch=%04x error occure\n", ch);
      continue;
    }
    if (normalize(str, nfc, UNORM_NFC)) {
      printf("ch=%04x error occure\n", ch);
      continue;
    }
    if (strcmp(nfd, nfc)) {
      printf("%04x\t%s\t%s\n", ch, nfd, nfc);
    }
  }
}


x86 assembly (clang, -O0):
<ccdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0x110000,-0x4(%rbp)
jge    1252 <ccdump+0x102>
mov    -0x4(%rbp),%edi
call   1070 <U_IS_UNICODE_CHAR@plt>
cmp    $0x0,%eax
jne    1185 <ccdump+0x35>
jmp    1244 <ccdump+0xf4>
mov    -0x4(%rbp),%edi
lea    -0xb(%rbp),%rsi
call   1030 <ucs2utf@plt>
lea    -0xb(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    0x2e3d(%rip),%rax
mov    (%rax),%edx
call   1050 <normalize@plt>
cmp    $0x0,%rax
je     11ca <ccdump+0x7a>
mov    -0x4(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1244 <ccdump+0xf4>
lea    -0xb(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    0x2e1c(%rip),%rax
mov    (%rax),%edx
call   1050 <normalize@plt>
cmp    $0x0,%rax
je     1203 <ccdump+0xb3>
mov    -0x4(%rbp),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1244 <ccdump+0xf4>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     123f <ccdump+0xef>
mov    -0x4(%rbp),%esi
lea    -0x110(%rbp),%rdx
lea    -0x210(%rbp),%rcx
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1244 <ccdump+0xf4>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <ccdump+0x12>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccdump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    $0x1,%ebx
lea    0x9(%rsp),%r14
mov    0x2e6e(%rip),%r13
lea    0x110(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xe7a(%rip),%rbp
jmp    11a7 <ccdump+0x57>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x110000,%ebx
je     1211 <ccdump+0xc1>
mov    %ebx,%edi
call   1070 <U_IS_UNICODE_CHAR@plt>
test   %eax,%eax
je     119c <ccdump+0x4c>
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <ucs2utf@plt>
mov    0x0(%r13),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <normalize@plt>
test   %rax,%rax
jne    1190 <ccdump+0x40>
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <normalize@plt>
test   %rax,%rax
jne    1190 <ccdump+0x40>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     119c <ccdump+0x4c>
lea    0xe16(%rip),%rdi
mov    %ebx,%esi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    119c <ccdump+0x4c>
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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