#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int unicode_count(char *);
int unicode_encode(int, char *);
int main(void) {
  int i = 0x2500;
  for (int j = 0; j < 8; j++)
    printf("code count char  ");
  printf("\n");
  for (int j = 0; j < 16; j++) {
    int k = i;
    for (int j = 0; j < 8; j++) {
      char box[5];
      int count = unicode_encode(i, box);
      if (unicode_count(box) != count)
        printf("Error - count does not match. count1: %d  count2: %d"
               "\n",
               count, unicode_count(box));
      printf("%4x  ", i);
      printf(" %d   ", count);
      printf(" %s    ", box);
      i += 0x10;
    }
    printf("\n");
    i = k + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2500,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1173 <main+0x43>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x1d>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    125c <main+0x12c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    1237 <main+0x107>
mov    -0x8(%rbp),%edi
lea    -0x1d(%rbp),%rsi
call   1040 <unicode_encode@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1d(%rbp),%rdi
call   1030 <unicode_count@plt>
cmp    -0x24(%rbp),%eax
je     11ec <main+0xbc>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
lea    -0x1d(%rbp),%rdi
call   1030 <unicode_count@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%edx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1d(%rbp),%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119f <main+0x6f>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1188 <main+0x58>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    $0x2500,%r14d
lea    0x3(%rsp),%rbx
lea    0xe97(%rip),%r12
jmp    11d7 <main+0x97>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x1,%r14d
cmp    $0x2510,%r14d
je     1256 <main+0x116>
xor    %r15d,%r15d
jmp    121b <main+0xdb>
nopl   0x0(%rax)
lea    0xe61(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe57(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x10,%r15d
cmp    $0x80,%r15d
je     11c0 <main+0x80>
lea    (%r14,%r15,1),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <unicode_encode@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
call   1030 <unicode_count@plt>
cmp    %r13d,%eax
je     11e0 <main+0xa0>
mov    %rbx,%rdi
call   1030 <unicode_count@plt>
lea    0xdca(%rip),%rdi
mov    %r13d,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11e0 <main+0xa0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"code count char \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [54 x i8] c"Error - count does not match. count1: %d count2: %d\0A\00"
@.str.3 = [6 x i8] c"%4x \00"
@.str.4 = [7 x i8] c" %d \00"
@.str.5 = [8 x i8] c" %s \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [5 x i8]
%8 = alloca i32
store i32 0, i32* %1
store i32 9472, i32* %2
store i32 0, i32* %3
br label %9
9: ; preds = %14, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 8
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %9
17: ; preds = %9
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %19
19: ; preds = %56, %17
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 16
br i1 %21, label %22, label %59
22: ; preds = %19
%23 = load i32, i32* %2
store i32 %23, i32* %5
store i32 0, i32* %6
br label %24
24: ; preds = %49, %22
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 8
br i1 %26, label %27, label %52
27: ; preds = %24
%28 = load i32, i32* %2
%29 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%30 = call i32 @unicode_encode(i32 %28, i8* %29)
store i32 %30, i32* %8
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%32 = call i32 @unicode_count(i8* %31)
%33 = load i32, i32* %8
%34 = icmp ne i32 %32, %33
br i1 %34, label %35, label %40
35: ; preds = %27
%36 = load i32, i32* %8
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%38 = call i32 @unicode_count(i8* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %36, i32 %38)
br label %40
40: ; preds = %35, %27
%41 = load i32, i32* %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %8
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %45)
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 16
store i32 %48, i32* %2
br label %49
49: ; preds = %40
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %24
52: ; preds = %24
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
br label %56
56: ; preds = %52
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %19
59: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"code count char \00"
@.str.2 = [54 x i8] c"Error - count does not match. count1: %d count2: %d\0A\00"
@.str.3 = [6 x i8] c"%4x \00"
@.str.4 = [7 x i8] c" %d \00"
@.str.5 = [8 x i8] c" %s \00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 10)
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
br label %12
12: ; preds = %0, %15
%13 = phi i32 [ 9472, %0 ], [ %17, %15 ]
br label %19
14: ; preds = %15
ret i32 0
15: ; preds = %28
%16 = call i32 @putchar(i32 10)
%17 = add nuw nsw i32 %13, 1
%18 = icmp eq i32 %17, 9488
br i1 %18, label %14, label %12
19: ; preds = %12, %28
%20 = phi i32 [ 0, %12 ], [ %33, %28 ]
%21 = phi i32 [ %13, %12 ], [ %32, %28 ]
%22 = call i32 @unicode_encode(i32 %21, i8* %11)
%23 = call i32 @unicode_count(i8* %11)
%24 = icmp eq i32 %23, %22
br i1 %24, label %28, label %25
25: ; preds = %19
%26 = call i32 @unicode_count(i8* %11)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %26)
br label %28
28: ; preds = %25, %19
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%32 = add nuw nsw i32 %21, 16
%33 = add nuw nsw i32 %20, 1
%34 = icmp eq i32 %33, 8
br i1 %34, label %15, label %19
}