#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;
typedef scalar_t__ UBlockCode;

/* Variables and functions */
int /*<<< orphan*/ U_IS_UNICODE_CHAR(int);
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ ublock_getCode(int);
int /*<<< orphan*/ ucs2utf(int, unsigned char *);
void blockcode(void) {
  UChar32 ch;
  unsigned char *p, src[7];
  UBlockCode code, lc = -1;
  for (ch = 1; ch < 0x110000; ch++) {
    if (!U_IS_UNICODE_CHAR(ch)) {
      continue;
    }
    code = ublock_getCode(ch);
    if (code != lc) {
      ucs2utf(ch, src);
      for (p = src; *p; p++) {
        printf("%x:", *p);
      }
      printf("\t%04x\t%d\n", ch, code);
    }
    lc = code;
  }
}


x86 assembly (clang, -O0):
<blockcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0xffffffffffffffff,-0x28(%rbp)
ff
movl   $0x1,-0x4(%rbp)
cmpl   $0x110000,-0x4(%rbp)
jge    1206 <blockcode+0xc6>
mov    -0x4(%rbp),%edi
call   1060 <U_IS_UNICODE_CHAR@plt>
cmp    $0x0,%eax
jne    117a <blockcode+0x3a>
jmp    11f8 <blockcode+0xb8>
mov    -0x4(%rbp),%edi
call   1030 <ublock_getCode@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     11f0 <blockcode+0xb0>
mov    -0x4(%rbp),%edi
lea    -0x17(%rbp),%rsi
call   1040 <ucs2utf@plt>
lea    -0x17(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11db <blockcode+0x9b>
mov    -0x10(%rbp),%rax
movzbl (%rax),%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a8 <blockcode+0x68>
mov    -0x4(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <blockcode+0x17>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockcode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0xffffffffffffffff,%rbp
lea    0x1(%rsp),%r14
lea    0xea1(%rip),%r15
lea    0xe96(%rip),%r12
jmp    118d <blockcode+0x4d>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rbp
add    $0x1,%ebx
cmp    $0x110000,%ebx
je     11db <blockcode+0x9b>
mov    %ebx,%edi
call   1060 <U_IS_UNICODE_CHAR@plt>
test   %eax,%eax
je     1182 <blockcode+0x42>
mov    %ebx,%edi
call   1030 <ublock_getCode@plt>
cmp    %rbp,%rax
je     1182 <blockcode+0x42>
mov    %rax,%r13
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <ucs2utf@plt>
mov    0x1(%rsp),%al
test   %al,%al
je     1170 <blockcode+0x30>
lea    0x2(%rsp),%rbp
xchg   %ax,%ax
movzbl %al,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
jne    11c0 <blockcode+0x80>
jmp    1170 <blockcode+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%x:\00"
@.str.1 = [10 x i8] c"\09%04x\09%d\0A\00"
define void @blockcode() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [7 x i8]
%4 = alloca i64
%5 = alloca i64
store i64 -1, i64* %5
store i32 1, i32* %1
br label %6
6: ; preds = %43, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1114112
br i1 %8, label %9, label %46
9: ; preds = %6
%10 = load i32, i32* %1
%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 %43
14: ; preds = %9
%15 = load i32, i32* %1
%16 = call i64 @ublock_getCode(i32 %15)
store i64 %16, i64* %4
%17 = load i64, i64* %4
%18 = load i64, i64* %5
%19 = icmp ne i64 %17, %18
br i1 %19, label %20, label %41
20: ; preds = %14
%21 = load i32, i32* %1
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%23 = call i32 @ucs2utf(i32 %21, i8* %22)
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8* %24, i8** %2
br label %25
25: ; preds = %34, %20
%26 = load i8*, i8** %2
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %37
29: ; preds = %25
%30 = load i8*, i8** %2
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %29
%35 = load i8*, i8** %2
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %2
br label %25
37: ; preds = %25
%38 = load i32, i32* %1
%39 = load i64, i64* %4
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %38, i64 %39)
br label %41
41: ; preds = %37, %14
%42 = load i64, i64* %4
store i64 %42, i64* %5
br label %43
43: ; preds = %41, %13
%44 = load i32, i32* %1
%45 = add nsw i32 %44, 1
store i32 %45, i32* %1
br label %6
46: ; preds = %6
ret void
}

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