#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  FILE *file;
  FILE *file2;
  char buffer[2];
  char buffer2[4];
  int iterator;
  if (argc != 3) {
    printf("Please provide two files ORIGINAL and UTF-8-TRANSLATE..\n");
    return -1;
  }
  file = fopen(argv[1], "r");
  if (file == NULL) {
    printf("failed to open: %s..\n", argv[1]);
    return -1;
  }
  file2 = fopen(argv[2], "r");
  if (file2 == NULL) {
    printf("failed to open: %s..\n", argv[2]);
    return -1;
  }
  iterator = 0;
  while (fread(buffer, 1, 1, file) == 1) {
    if (fread(&(buffer[1]), 1, 1, file) != 1) {
      break;
    }
    if (buffer[1] != '\n') {
      printf("Expected to find new line character at=%d..\n", iterator);
      return -1;
    }
    if (fread(buffer2, 1, 1, file2) != 1) {
      printf(
          "failed to read utf-8 file (while handling buffer[0]='%c' (%u)..\n",
          iterator, buffer[0], (unsigned char)buffer[0]);
      return -1;
    }
    if (fread(&(buffer2[1]), 1, 1, file2) != 1) {
      printf("failed to read utf-8 file (while handling buffer[0]='%c'..\n",
             iterator);
      return -1;
    }
    if (buffer2[1] == '\n') {
      printf("/* store item associated to code %d */\n", iterator);
      printf("table[%d].size      = 1;\n", iterator);
      printf("table[%d].buffer[0] = (unsigned char) %d; /* 0x%x */\n\n",
             iterator, (unsigned char)iterator, (unsigned char)iterator);
      iterator++;
      continue;
    }
    if (fread(&(buffer2[2]), 1, 1, file2) != 1) {
      printf("failed to read utf-8 file (2 type unit)..\n");
      return -1;
    }
    if (buffer2[2] == '\n') {
      printf("/* store item associated to code %d */\n", iterator);
      printf("table[%d].size      = 2;\n", iterator);
      printf("table[%d].buffer[0] = (unsigned char) %u; /* 0x%x */\n", iterator,
             (unsigned char)buffer2[0], (unsigned char)buffer2[0]);
      printf("table[%d].buffer[1] = (unsigned char) %u; /* 0x%x */\n\n",
             iterator, (unsigned char)buffer2[1], (unsigned char)buffer2[1]);
      iterator++;
      continue;
    }
    if (fread(&(buffer2[3]), 1, 1, file2) != 1) {
      printf("failed to read utf-8 file (3 type unit)..\n");
      return -1;
    }
    printf("/* store item associated to code %d */\n", iterator);
    printf("table[%d].size      = 3;\n", iterator);
    printf("table[%d].buffer[0] = (unsigned char) %u; /* 0x%x */\n", iterator,
           (unsigned char)buffer2[0], (unsigned char)buffer2[0]);
    printf("table[%d].buffer[1] = (unsigned char) %u; /* 0x%x */\n", iterator,
           (unsigned char)buffer2[1], (unsigned char)buffer2[1]);
    printf("table[%d].buffer[2] = (unsigned char) %u; /* 0x%x */\n\n", iterator,
           (unsigned char)buffer2[2], (unsigned char)buffer2[2]);
    iterator++;
    continue;
  }
  fclose(file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     117a <main+0x3a>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb0(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11bf <main+0x7f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe6b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1204 <main+0xc4>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
movl   $0x0,-0x2c(%rbp)
lea    -0x22(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    14b2 <main+0x372>
lea    -0x22(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
je     124e <main+0x10e>
jmp    14b2 <main+0x372>
movsbl -0x21(%rbp),%eax
cmp    $0xa,%eax
je     1278 <main+0x138>
mov    -0x2c(%rbp),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
lea    -0x26(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
je     12ba <main+0x17a>
mov    -0x2c(%rbp),%esi
movsbl -0x22(%rbp),%edx
movzbl -0x22(%rbp),%ecx
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
lea    -0x26(%rbp),%rdi
add    $0x1,%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
je     12f8 <main+0x1b8>
mov    -0x2c(%rbp),%esi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
movsbl -0x25(%rbp),%eax
cmp    $0xa,%eax
jne    1352 <main+0x212>
mov    -0x2c(%rbp),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    -0x2c(%rbp),%eax
movzbl %al,%edx
mov    -0x2c(%rbp),%eax
movzbl %al,%ecx
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    120b <main+0xcb>
lea    -0x26(%rbp),%rdi
add    $0x2,%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
je     138d <main+0x24d>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
movsbl -0x24(%rbp),%eax
cmp    $0xa,%eax
jne    13fc <main+0x2bc>
mov    -0x2c(%rbp),%esi
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
movzbl -0x26(%rbp),%edx
movzbl -0x26(%rbp),%ecx
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
movzbl -0x25(%rbp),%edx
movzbl -0x25(%rbp),%ecx
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    120b <main+0xcb>
lea    -0x26(%rbp),%rdi
add    $0x3,%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
je     1437 <main+0x2f7>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c2 <main+0x382>
mov    -0x2c(%rbp),%esi
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
movzbl -0x26(%rbp),%edx
movzbl -0x26(%rbp),%ecx
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
movzbl -0x25(%rbp),%edx
movzbl -0x25(%rbp),%ecx
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
movzbl -0x24(%rbp),%edx
movzbl -0x24(%rbp),%ecx
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    120b <main+0xcb>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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
cmp    $0x3,%edi
jne    11ce <main+0x7e>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
lea    0xe92(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1397 <main+0x247>
mov    %rax,%rbx
mov    0x10(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     13a9 <main+0x259>
mov    %rax,%r14
lea    0x6(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    139d <main+0x24d>
lea    0x7(%rsp),%r15
lea    0x3(%rsp),%r12
lea    0x2(%rsp),%r13
xor    %ebp,%ebp
jmp    1239 <main+0xe9>
lea    0x10c8(%rip),%rdi
call   1030 <puts@plt>
jmp    13bb <main+0x26b>
nop
lea    0xedb(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xef3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movzbl %bpl,%ecx
lea    0xef9(%rip),%rdi
mov    %ebp,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebp
lea    0x6(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    139d <main+0x24d>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    139d <main+0x24d>
cmpb   $0xa,0x7(%rsp)
jne    13cf <main+0x27f>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    13d8 <main+0x288>
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    13f2 <main+0x2a2>
cmpb   $0xa,0x3(%rsp)
je     11e0 <main+0x90>
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    1404 <main+0x2b4>
cmpb   $0xa,0x4(%rsp)
jne    1318 <main+0x1c8>
lea    0xdeb(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe54(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movzbl 0x2(%rsp),%ecx
lea    0xe59(%rip),%rdi
mov    %ebp,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
movzbl 0x3(%rsp),%ecx
lea    0xe78(%rip),%rdi
jmp    120b <main+0xbb>
lea    0x5(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    1412 <main+0x2c2>
lea    0xd83(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe73(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movzbl 0x2(%rsp),%ecx
lea    0xdf1(%rip),%rdi
mov    %ebp,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
movzbl 0x3(%rsp),%ecx
lea    0xe61(%rip),%rdi
mov    %ebp,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
movzbl 0x4(%rsp),%ecx
lea    0xe80(%rip),%rdi
jmp    120b <main+0xbb>
mov    0x8(%rbp),%rsi
jmp    13ad <main+0x25d>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    13c0 <main+0x270>
mov    0x10(%rbp),%rsi
lea    0xc4e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc42(%rip),%rdi
jmp    13f9 <main+0x2a9>
movzbl 0x6(%rsp),%ecx
movsbl %cl,%edx
lea    0xc5e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13bb <main+0x26b>
lea    0xc8d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13bb <main+0x26b>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
jmp    13bb <main+0x26b>
lea    0xe30(%rip),%rdi
call   1030 <puts@plt>
jmp    13bb <main+0x26b>

LLVM IR (-O0):
@.str = [57 x i8] c"Please provide two files ORIGINAL and UTF-8-TRANSLATE..\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [22 x i8] c"failed to open: %s..\0A\00"
@.str.3 = [45 x i8] c"Expected to find new line character at=%d..\0A\00"
@.str.4 = [65 x i8] c"failed to read utf-8 file (while handling buffer[0]='%c' (%u)..\0A\00"
@.str.5 = [60 x i8] c"failed to read utf-8 file (while handling buffer[0]='%c'..\0A\00"
@.str.6 = [40 x i8] c"/* store item associated to code %d */\0A\00"
@.str.7 = [26 x i8] c"table[%d].size = 1;\0A\00"
@.str.8 = [55 x i8] c"table[%d].buffer[0] = (unsigned char) %d; /* 0x%x */\0A\0A\00"
@.str.9 = [43 x i8] c"failed to read utf-8 file (2 type unit)..\0A\00"
@.str.10 = [26 x i8] c"table[%d].size = 2;\0A\00"
@.str.11 = [54 x i8] c"table[%d].buffer[0] = (unsigned char) %u; /* 0x%x */\0A\00"
@.str.12 = [55 x i8] c"table[%d].buffer[1] = (unsigned char) %u; /* 0x%x */\0A\0A\00"
@.str.13 = [43 x i8] c"failed to read utf-8 file (3 type unit)..\0A\00"
@.str.14 = [26 x i8] c"table[%d].size = 3;\0A\00"
@.str.15 = [54 x i8] c"table[%d].buffer[1] = (unsigned char) %u; /* 0x%x */\0A\00"
@.str.16 = [55 x i8] c"table[%d].buffer[2] = (unsigned char) %u; /* 0x%x */\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 [2 x i8]
%9 = alloca [4 x i8]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %177
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
%20 = load i32*, i32** %6
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %27
22: ; preds = %15
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %25)
store i32 -1, i32* %3
br label %177
27: ; preds = %15
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %7
%32 = load i32*, i32** %7
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %39
34: ; preds = %27
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %37)
store i32 -1, i32* %3
br label %177
39: ; preds = %27
store i32 0, i32* %10
br label %40
40: ; preds = %143, %113, %86, %39
%41 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%42 = load i32*, i32** %6
%43 = call i32 @fread(i8* %41, i32 1, i32 1, i32* %42)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %174
45: ; preds = %40
%46 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%47 = load i32*, i32** %6
%48 = call i32 @fread(i8* %46, i32 1, i32 1, i32* %47)
%49 = icmp ne i32 %48, 1
br i1 %49, label %50, label %51
50: ; preds = %45
br label %174
51: ; preds = %45
%52 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp ne i32 %54, 10
br i1 %55, label %56, label %59
56: ; preds = %51
%57 = load i32, i32* %10
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %57)
store i32 -1, i32* %3
br label %177
59: ; preds = %51
%60 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%61 = load i32*, i32** %7
%62 = call i32 @fread(i8* %60, i32 1, i32 1, i32* %61)
%63 = icmp ne i32 %62, 1
br i1 %63, label %64, label %73
64: ; preds = %59
%65 = load i32, i32* %10
%66 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0), i32 %65, i32 %68, i32 %71)
store i32 -1, i32* %3
br label %177
73: ; preds = %59
%74 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
%75 = load i32*, i32** %7
%76 = call i32 @fread(i8* %74, i32 1, i32 1, i32* %75)
%77 = icmp ne i32 %76, 1
br i1 %77, label %78, label %81
78: ; preds = %73
%79 = load i32, i32* %10
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %79)
store i32 -1, i32* %3
br label %177
81: ; preds = %73
%82 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 10
br i1 %85, label %86, label %101
86: ; preds = %81
%87 = load i32, i32* %10
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %10
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %89)
%91 = load i32, i32* %10
%92 = load i32, i32* %10
%93 = trunc i32 %92 to i8
%94 = zext i8 %93 to i32
%95 = load i32, i32* %10
%96 = trunc i32 %95 to i8
%97 = zext i8 %96 to i32
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0), i32 %91, i32 %94, i32 %97)
%99 = load i32, i32* %10
%100 = add nsw i32 %99, 1
store i32 %100, i32* %10
br label %40
101: ; preds = %81
%102 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 2
%103 = load i32*, i32** %7
%104 = call i32 @fread(i8* %102, i32 1, i32 1, i32* %103)
%105 = icmp ne i32 %104, 1
br i1 %105, label %106, label %108
106: ; preds = %101
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %3
br label %177
108: ; preds = %101
%109 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 2
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %111, 10
br i1 %112, label %113, label %136
113: ; preds = %108
%114 = load i32, i32* %10
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %114)
%116 = load i32, i32* %10
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %116)
%118 = load i32, i32* %10
%119 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), i32 %118, i32 %121, i32 %124)
%126 = load i32, i32* %10
%127 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
%128 = load i8, i8* %127
%129 = zext i8 %128 to i32
%130 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
%131 = load i8, i8* %130
%132 = zext i8 %131 to i32
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.12, i64 0, i64 0), i32 %126, i32 %129, i32 %132)
%134 = load i32, i32* %10
%135 = add nsw i32 %134, 1
store i32 %135, i32* %10
br label %40
136: ; preds = %108
%137 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 3
%138 = load i32*, i32** %7
%139 = call i32 @fread(i8* %137, i32 1, i32 1, i32* %138)
%140 = icmp ne i32 %139, 1
br i1 %140, label %141, label %143
141: ; preds = %136
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.13, i64 0, i64 0))
store i32 -1, i32* %3
br label %177
143: ; preds = %136
%144 = load i32, i32* %10
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %144)
%146 = load i32, i32* %10
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i32 %146)
%148 = load i32, i32* %10
%149 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%153 = load i8, i8* %152
%154 = zext i8 %153 to i32
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), i32 %148, i32 %151, i32 %154)
%156 = load i32, i32* %10
%157 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
%158 = load i8, i8* %157
%159 = zext i8 %158 to i32
%160 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
%161 = load i8, i8* %160
%162 = zext i8 %161 to i32
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.15, i64 0, i64 0), i32 %156, i32 %159, i32 %162)
%164 = load i32, i32* %10
%165 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 2
%166 = load i8, i8* %165
%167 = zext i8 %166 to i32
%168 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 2
%169 = load i8, i8* %168
%170 = zext i8 %169 to i32
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.16, i64 0, i64 0), i32 %164, i32 %167, i32 %170)
%172 = load i32, i32* %10
%173 = add nsw i32 %172, 1
store i32 %173, i32* %10
br label %40
174: ; preds = %50, %40
%175 = load i32*, i32** %6
%176 = call i32 @fclose(i32* %175)
store i32 0, i32* %3
br label %177
177: ; preds = %174, %141, %106, %78, %64, %56, %34, %22, %13
%178 = load i32, i32* %3
ret i32 %178
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [22 x i8] c"failed to open: %s..\0A\00"
@.str.3 = [45 x i8] c"Expected to find new line character at=%d..\0A\00"
@.str.4 = [65 x i8] c"failed to read utf-8 file (while handling buffer[0]='%c' (%u)..\0A\00"
@.str.5 = [60 x i8] c"failed to read utf-8 file (while handling buffer[0]='%c'..\0A\00"
@.str.6 = [40 x i8] c"/* store item associated to code %d */\0A\00"
@.str.7 = [26 x i8] c"table[%d].size = 1;\0A\00"
@.str.8 = [55 x i8] c"table[%d].buffer[0] = (unsigned char) %d; /* 0x%x */\0A\0A\00"
@.str.10 = [26 x i8] c"table[%d].size = 2;\0A\00"
@.str.11 = [54 x i8] c"table[%d].buffer[0] = (unsigned char) %u; /* 0x%x */\0A\00"
@.str.12 = [55 x i8] c"table[%d].buffer[1] = (unsigned char) %u; /* 0x%x */\0A\0A\00"
@.str.14 = [26 x i8] c"table[%d].size = 3;\0A\00"
@.str.15 = [54 x i8] c"table[%d].buffer[1] = (unsigned char) %u; /* 0x%x */\0A\00"
@.str.16 = [55 x i8] c"table[%d].buffer[2] = (unsigned char) %u; /* 0x%x */\0A\0A\00"
@str = [42 x i8] c"failed to read utf-8 file (3 type unit)..\00"
@str.17 = [42 x i8] c"failed to read utf-8 file (2 type unit)..\00"
@str.18 = [56 x i8] c"Please provide two files ORIGINAL and UTF-8-TRANSLATE..\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i8]
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.18, i64 0, i64 0))
br label %104
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i8*, i8** %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %104
18: ; preds = %10
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %31, label %23
23: ; preds = %18
%24 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %13)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %102
26: ; preds = %23
%27 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
br label %34
31: ; preds = %18
%32 = load i8*, i8** %19
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %104
34: ; preds = %26, %64
%35 = phi i32 [ 0, %26 ], [ %65, %64 ]
%36 = call i32 @fread(i8* %27, i32 1, i32 1, i32* %13)
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %102
38: ; preds = %34
%39 = load i8, i8* %27
%40 = icmp eq i8 %39, 10
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %35)
br label %104
43: ; preds = %38
%44 = call i32 @fread(i8* %6, i32 1, i32 1, i32* %21)
%45 = icmp eq i32 %44, 1
br i1 %45, label %51, label %46
46: ; preds = %43
%47 = load i8, i8* %5
%48 = sext i8 %47 to i32
%49 = zext i8 %47 to i32
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0), i32 %35, i32 %48, i32 %49)
br label %104
51: ; preds = %43
%52 = call i32 @fread(i8* %28, i32 1, i32 1, i32* %21)
%53 = icmp eq i32 %52, 1
br i1 %53, label %56, label %54
54: ; preds = %51
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %35)
br label %104
56: ; preds = %51
%57 = load i8, i8* %28
%58 = icmp eq i8 %57, 10
br i1 %58, label %59, label %68
59: ; preds = %56
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %35)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %35)
%62 = and i32 %35, 255
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0), i32 %35, i32 %62, i32 %62)
br label %64
64: ; preds = %59, %76, %90
%65 = add nuw nsw i32 %35, 1
%66 = call i32 @fread(i8* %5, i32 1, i32 1, i32* %13)
%67 = icmp eq i32 %66, 1
br i1 %67, label %34, label %102
68: ; preds = %56
%69 = call i32 @fread(i8* %29, i32 1, i32 1, i32* %21)
%70 = icmp eq i32 %69, 1
br i1 %70, label %73, label %71
71: ; preds = %68
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.17, i64 0, i64 0))
br label %104
73: ; preds = %68
%74 = load i8, i8* %29
%75 = icmp eq i8 %74, 10
br i1 %75, label %76, label %85
76: ; preds = %73
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %35)
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %35)
%79 = load i8, i8* %6
%80 = zext i8 %79 to i32
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), i32 %35, i32 %80, i32 %80)
%82 = load i8, i8* %28
%83 = zext i8 %82 to i32
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.12, i64 0, i64 0), i32 %35, i32 %83, i32 %83)
br label %64
85: ; preds = %73
%86 = call i32 @fread(i8* %30, i32 1, i32 1, i32* %21)
%87 = icmp eq i32 %86, 1
br i1 %87, label %90, label %88
88: ; preds = %85
%89 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br label %104
90: ; preds = %85
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32 %35)
%92 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i32 %35)
%93 = load i8, i8* %6
%94 = zext i8 %93 to i32
%95 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), i32 %35, i32 %94, i32 %94)
%96 = load i8, i8* %28
%97 = zext i8 %96 to i32
%98 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.15, i64 0, i64 0), i32 %35, i32 %97, i32 %97)
%99 = load i8, i8* %29
%100 = zext i8 %99 to i32
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.16, i64 0, i64 0), i32 %35, i32 %100, i32 %100)
br label %64
102: ; preds = %64, %34, %23
%103 = tail call i32 @fclose(i32* %13)
br label %104
104: ; preds = %102, %88, %71, %54, %46, %41, %31, %15, %8
%105 = phi i32 [ -1, %8 ], [ -1, %15 ], [ -1, %31 ], [ 0, %102 ], [ -1, %41 ], [ -1, %46 ], [ -1, %54 ], [ -1, %71 ], [ -1, %88 ]
ret i32 %105
}