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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char **, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printchr16(unsigned char **);
int /*<<< orphan*/ printf(char *, int);
int strlen(unsigned char *);
int main() {
  unsigned char chr[16][2];
  FILE *HzK = fopen("HZK16", "rb");
  unsigned char teststr[] = {0xd6, 0xf7, 0xb2, 0xbb, 0xd4,
                             0xda, 0xba, 0xf5, '\0'};
  int len = strlen(teststr);
  printf("%d\n", len);
  int i;
  for (i = 0; i < len; i += 2) {
    int x = teststr[i] - 0xa0;
    int y = teststr[i + 1] - 0xa0;
    fseek(HzK, (94 * (x - 1) + (y - 1)) * 32, SEEK_SET);
    fread(chr, 32, 1, HzK);
    printchr16(chr);
  }
  fclose(HzK);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe79(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    0xe6c(%rip),%rax
mov    %rax,-0x41(%rbp)
mov    0xe6a(%rip),%al
mov    %al,-0x39(%rbp)
lea    -0x41(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%esi
lea    0xe52(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    1252 <main+0xe2>
movslq -0x4c(%rbp),%rax
movzbl -0x41(%rbp,%rax,1),%eax
sub    $0xa0,%eax
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
movzbl -0x41(%rbp,%rax,1),%eax
sub    $0xa0,%eax
mov    %eax,-0x54(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x50(%rbp),%eax
sub    $0x1,%eax
imul   $0x5e,%eax,%esi
mov    -0x54(%rbp),%eax
sub    $0x1,%eax
add    %eax,%esi
shl    $0x5,%esi
mov    0x2dc3(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0x20,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
lea    -0x30(%rbp),%rdi
call   1090 <printchr16@plt>
mov    -0x4c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4c(%rbp)
jmp    11cc <main+0x5c>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xe7d(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
movabs $0xf5badad4bbb2f7d6,%rax
da ba f5
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
mov    %rsp,%rdi
call   1050 <strlen@plt>
mov    %eax,%r14d
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
test   %r14d,%r14d
jle    1229 <main+0xb9>
xor    %ebp,%ebp
mov    0x2e14(%rip),%r12
lea    0x10(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rsp,%rbp,1),%eax
movzbl 0x1(%rsp,%rbp,1),%ecx
imul   $0x5e,%eax,%esi
add    %ecx,%esi
shl    $0x5,%esi
add    $0xfff88820,%esi
mov    (%r12),%edx
mov    %rbx,%rdi
call   1070 <fseek@plt>
mov    %r15,%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %r15,%rdi
call   1090 <printchr16@plt>
add    $0x2,%rbp
cmp    %ebp,%r14d
jg     11e0 <main+0x70>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"HZK16\00"
@.str.1 = [3 x i8] c"rb\00"
@__const.main.teststr = [9 x i8] c"\D6\F7\B2\BB\D4\DA\BA\F5\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@SEEK_SET = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x [2 x i8]]
%3 = alloca i32*
%4 = alloca [9 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %3
%10 = bitcast [9 x i8]* %4 to i8*
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %13)
store i32 0, i32* %6
br label %15
15: ; preds = %50, %0
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %53
19: ; preds = %15
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = sub nsw i32 %24, 160
store i32 %25, i32* %7
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = sub nsw i32 %31, 160
store i32 %32, i32* %8
%33 = load i32*, i32** %3
%34 = load i32, i32* %7
%35 = sub nsw i32 %34, 1
%36 = mul nsw i32 94, %35
%37 = load i32, i32* %8
%38 = sub nsw i32 %37, 1
%39 = add nsw i32 %36, %38
%40 = mul nsw i32 %39, 32
%41 = load i32, i32* @SEEK_SET
%42 = call i32 @fseek(i32* %33, i32 %40, i32 %41)
%43 = getelementptr inbounds [16 x [2 x i8]], [16 x [2 x i8]]* %2, i64 0, i64 0
%44 = bitcast [2 x i8]* %43 to i8**
%45 = load i32*, i32** %3
%46 = call i32 @fread(i8** %44, i32 32, i32 1, i32* %45)
%47 = getelementptr inbounds [16 x [2 x i8]], [16 x [2 x i8]]* %2, i64 0, i64 0
%48 = bitcast [2 x i8]* %47 to i8**
%49 = call i32 @printchr16(i8** %48)
br label %50
50: ; preds = %19
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 2
store i32 %52, i32* %6
br label %15
53: ; preds = %15
%54 = load i32*, i32** %3
%55 = call i32 @fclose(i32* %54)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"HZK16\00"
@.str.1 = [3 x i8] c"rb\00"
@__const.main.teststr = [9 x i8] c"\D6\F7\B2\BB\D4\DA\BA\F5\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@SEEK_SET = global i32 0
define i32 @main() {
%1 = alloca [16 x [2 x i8]]
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [16 x [2 x i8]], [16 x [2 x i8]]* %1, i64 0, i64 0, i64 0
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %31
9: ; preds = %0
%10 = bitcast [16 x [2 x i8]]* %1 to i8**
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %28, %11 ]
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = or i64 %12, 1
%17 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = mul nuw nsw i32 %15, 94
%21 = add nuw nsw i32 %20, %19
%22 = shl nuw nsw i32 %21, 5
%23 = add nsw i32 %22, -489440
%24 = load i32, i32* @SEEK_SET
%25 = call i32 @fseek(i32* %4, i32 %23, i32 %24)
%26 = call i32 @fread(i8** %10, i32 32, i32 1, i32* %4)
%27 = call i32 @printchr16(i8** %10)
%28 = add nuw i64 %12, 2
%29 = trunc i64 %28 to i32
%30 = icmp sgt i32 %6, %29
br i1 %30, label %11, label %31
31: ; preds = %11, %0
%32 = call i32 @fclose(i32* %4)
ret i32 0
}