#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*/ uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int jistoutf16(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int iArgc, char *strArgv[]) {
  uint8_t t;
  uint16_t jisu, jisl, jis, utf16;
  uint32_t n;
  char strOutput[128];
  n = 0;
  for (jisl = 0x00; jisl <= 0x7F; jisl++) {
    if (n % 8 == 0) {
      printf("\n ");
    }
    utf16 = jistoutf16(0, jisl);
    printf(" 0x%04X,", utf16);
    n++;
  }
  printf("\n\n");
  n = 0;
  for (jisl = 0x00; jisl <= 0x7F; jisl++) {
    if (n % 8 == 0) {
      printf("\n ");
    }
    utf16 = jistoutf16(1, jisl);
    printf(" 0x%04X,", utf16);
    n++;
  }
  printf("\n\n");
  n = 0;
  for (jisu = 0x21; jisu < 0x7F; jisu++) {
    for (jisl = 0x21; jisl < 0x7F; jisl++) {
      if (n % 8 == 0) {
        printf("\n ");
      }
      jis = (jisu << 8) | jisl;
      utf16 = jistoutf16(2, jis);
      printf(" 0x%04X,", utf16);
      n++;
    }
  }
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x7f,-0x1c(%rbp)
jg     11a8 <main+0x88>
mov    -0x28(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1173 <main+0x53>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
xor    %edi,%edi
call   1040 <jistoutf16@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1147 <main+0x27>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x7f,-0x1c(%rbp)
jg     1228 <main+0x108>
mov    -0x28(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f0 <main+0xd0>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    $0x1,%edi
call   1040 <jistoutf16@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c4 <main+0xa4>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x21,-0x18(%rbp)
cmpl   $0x7f,-0x18(%rbp)
jge    12d8 <main+0x1b8>
movl   $0x21,-0x1c(%rbp)
cmpl   $0x7f,-0x1c(%rbp)
jge    12c5 <main+0x1a5>
mov    -0x28(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1281 <main+0x161>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
shl    $0x8,%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
mov    $0x2,%edi
call   1040 <jistoutf16@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1255 <main+0x135>
jmp    12ca <main+0x1aa>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1244 <main+0x124>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%r14
lea    0xeba(%rip),%rbx
xor    %ebp,%ebp
jmp    1170 <main+0x40>
nopl   (%rax)
xor    %edi,%edi
mov    %ebp,%esi
call   1050 <jistoutf16@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x80,%ebp
je     1182 <main+0x52>
test   $0x7,%bpl
jne    1150 <main+0x20>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <main+0x20>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6b(%rip),%r14
lea    0xe67(%rip),%rbx
xor    %ebp,%ebp
jmp    11c3 <main+0x93>
mov    $0x1,%edi
mov    %ebp,%esi
call   1050 <jistoutf16@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x80,%ebp
je     11d5 <main+0xa5>
test   $0x7,%bpl
jne    11a0 <main+0x70>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a0 <main+0x70>
lea    0xe30(%rip),%rdi
call   1030 <puts@plt>
mov    $0x21,%r15d
lea    0xe12(%rip),%r14
lea    0xe0e(%rip),%r12
xor    %r13d,%r13d
jmp    120e <main+0xde>
nopw   0x0(%rax,%rax,1)
add    $0x5e,%r13d
add    $0x1,%r15d
cmp    $0x7f,%r15d
je     1257 <main+0x127>
mov    %r15d,%ebx
shl    $0x8,%ebx
mov    $0x21,%ebp
jmp    1242 <main+0x112>
nopl   0x0(%rax,%rax,1)
mov    %ebp,%esi
or     %ebx,%esi
mov    $0x2,%edi
call   1050 <jistoutf16@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x7f,%ebp
je     1200 <main+0xd0>
lea    -0x1(%r13,%rbp,1),%eax
test   $0x7,%al
jne    1220 <main+0xf0>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1220 <main+0xf0>
lea    0xdae(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0A \00"
@.str.1 = [9 x i8] c" 0x%04X,\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
store i32 0, i32* %8
br label %13
13: ; preds = %29, %2
%14 = load i32, i32* %8
%15 = icmp sle i32 %14, 127
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = load i32, i32* %11
%18 = srem i32 %17, 8
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = load i32, i32* %8
%24 = call i32 @jistoutf16(i32 0, i32 %23)
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %11
%28 = add nsw i32 %27, 1
store i32 %28, i32* %11
br label %29
29: ; preds = %22
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %13
32: ; preds = %13
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %11
store i32 0, i32* %8
br label %34
34: ; preds = %50, %32
%35 = load i32, i32* %8
%36 = icmp sle i32 %35, 127
br i1 %36, label %37, label %53
37: ; preds = %34
%38 = load i32, i32* %11
%39 = srem i32 %38, 8
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %43
43: ; preds = %41, %37
%44 = load i32, i32* %8
%45 = call i32 @jistoutf16(i32 1, i32 %44)
store i32 %45, i32* %10
%46 = load i32, i32* %10
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %11
%49 = add nsw i32 %48, 1
store i32 %49, i32* %11
br label %50
50: ; preds = %43
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
br label %34
53: ; preds = %34
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %11
store i32 33, i32* %7
br label %55
55: ; preds = %83, %53
%56 = load i32, i32* %7
%57 = icmp slt i32 %56, 127
br i1 %57, label %58, label %86
58: ; preds = %55
store i32 33, i32* %8
br label %59
59: ; preds = %79, %58
%60 = load i32, i32* %8
%61 = icmp slt i32 %60, 127
br i1 %61, label %62, label %82
62: ; preds = %59
%63 = load i32, i32* %11
%64 = srem i32 %63, 8
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %68
68: ; preds = %66, %62
%69 = load i32, i32* %7
%70 = shl i32 %69, 8
%71 = load i32, i32* %8
%72 = or i32 %70, %71
store i32 %72, i32* %9
%73 = load i32, i32* %9
%74 = call i32 @jistoutf16(i32 2, i32 %73)
store i32 %74, i32* %10
%75 = load i32, i32* %10
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %11
%78 = add nsw i32 %77, 1
store i32 %78, i32* %11
br label %79
79: ; preds = %68
%80 = load i32, i32* %8
%81 = add nsw i32 %80, 1
store i32 %81, i32* %8
br label %59
82: ; preds = %59
br label %83
83: ; preds = %82
%84 = load i32, i32* %7
%85 = add nsw i32 %84, 1
store i32 %85, i32* %7
br label %55
86: ; preds = %55
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0A \00"
@.str.1 = [9 x i8] c" 0x%04X,\00"
@str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %9
%4 = phi i32 [ 0, %2 ], [ %12, %9 ]
%5 = and i32 %4, 7
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %3
%10 = tail call i32 @jistoutf16(i32 0, i32 %4)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i32 %4, 1
%13 = icmp eq i32 %12, 128
br i1 %13, label %14, label %3
14: ; preds = %9
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
br label %16
16: ; preds = %14, %22
%17 = phi i32 [ 0, %14 ], [ %25, %22 ]
%18 = and i32 %17, 7
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = tail call i32 @jistoutf16(i32 1, i32 %17)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i32 %17, 1
%26 = icmp eq i32 %25, 128
br i1 %26, label %27, label %16
27: ; preds = %22
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %48
%30 = phi i32 [ 94, %27 ], [ %51, %48 ]
%31 = phi i32 [ 33, %27 ], [ %50, %48 ]
%32 = phi i32 [ 0, %27 ], [ %49, %48 ]
%33 = shl i32 %31, 8
br label %34
34: ; preds = %29, %41
%35 = phi i32 [ %32, %29 ], [ %45, %41 ]
%36 = phi i32 [ 33, %29 ], [ %46, %41 ]
%37 = and i32 %35, 7
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
%42 = or i32 %36, %33
%43 = tail call i32 @jistoutf16(i32 2, i32 %42)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %43)
%45 = add nuw nsw i32 %35, 1
%46 = add nuw nsw i32 %36, 1
%47 = icmp eq i32 %45, %30
br i1 %47, label %48, label %34
48: ; preds = %41
%49 = add nuw nsw i32 %32, 94
%50 = add nuw nsw i32 %31, 1
%51 = add nuw nsw i32 %30, 94
%52 = icmp eq i32 %50, 127
br i1 %52, label %53, label %29
53: ; preds = %48
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}