#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 */
scalar_t__ EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *);
char *index(char *, char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char **argv) {
  char teststring[256];
  int loc;
  char *gstart;
  char combining[0x10000];
  void add_single_circle(char *);
  void add_double_circle(char *);
  FILE *infilefp;
  memset(combining, 0, 0x10000 * sizeof(char));
  if ((infilefp = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "ERROR - combining characters file %s not found.\n\n",
            argv[1]);
    exit(EXIT_FAILURE);
  }
  while (fscanf(infilefp, "%X", &loc) != EOF)
    combining[loc] = 1;
  fclose(infilefp);
  if ((infilefp = fopen(argv[2], "r")) == NULL) {
    fprintf(stderr, "ERROR - nonprinting characters file %s not found.\n\n",
            argv[1]);
    exit(EXIT_FAILURE);
  }
  while (fscanf(infilefp, "%X:%*s", &loc) != EOF)
    combining[loc] = 0;
  fclose(infilefp);
  teststring[256 - 1] = '\0';
  while (fgets(teststring, 256 - 1, stdin) != NULL) {
    sscanf(teststring, "%X", &loc);
    gstart = index(teststring, ':') + 1;
    if (combining[loc]) {
      if (strlen(gstart) < 35)
        add_single_circle(gstart);
      else
        add_double_circle(gstart);
    }
    printf("%s", teststring);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x10120(%rbp),%rdi
xor    %esi,%esi
mov    $0x10000,%edx
call   1080 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf5(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10128(%rbp)
cmp    $0x0,%rax
jne    124c <main+0x7c>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdc9(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
jmp    1251 <main+0x81>
mov    -0x10128(%rbp),%rdi
lea    0xdd5(%rip),%rsi
lea    -0x114(%rbp),%rdx
call   1090 <fscanf@plt>
mov    0x2d6e(%rip),%rcx
cmp    (%rcx),%rax
je     128f <main+0xbf>
movslq -0x114(%rbp),%rax
movb   $0x1,-0x10120(%rbp,%rax,1)
01
jmp    1251 <main+0x81>
mov    -0x10128(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd56(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10128(%rbp)
cmp    $0x0,%rax
jne    12eb <main+0x11b>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd5f(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
jmp    12f0 <main+0x120>
mov    -0x10128(%rbp),%rdi
lea    0xd6d(%rip),%rsi
lea    -0x114(%rbp),%rdx
call   1090 <fscanf@plt>
mov    0x2ccf(%rip),%rcx
cmp    (%rcx),%rax
je     132e <main+0x15e>
movslq -0x114(%rbp),%rax
movb   $0x0,-0x10120(%rbp,%rax,1)
jmp    12f0 <main+0x120>
mov    -0x10128(%rbp),%rdi
call   1050 <fclose@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x110(%rbp),%rdi
mov    0x2c9c(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     13fc <main+0x22c>
lea    -0x110(%rbp),%rdi
lea    0xcc4(%rip),%rsi
lea    -0x114(%rbp),%rdx
call   10d0 <sscanf@plt>
lea    -0x110(%rbp),%rdi
mov    $0x3a,%esi
call   10a0 <index@plt>
add    $0x1,%rax
mov    %rax,-0x120(%rbp)
movslq -0x114(%rbp),%rax
cmpb   $0x0,-0x10120(%rbp,%rax,1)
je     13e4 <main+0x214>
mov    -0x120(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x23,%eax
jge    13d3 <main+0x203>
mov    -0x120(%rbp),%rdi
call   1040 <add_single_circle@plt>
jmp    13df <main+0x20f>
mov    -0x120(%rbp),%rdi
call   1030 <add_double_circle@plt>
jmp    13e4 <main+0x214>
lea    -0x110(%rbp),%rsi
lea    0xc80(%rip),%rdi
call   1070 <printf@plt>
jmp    133e <main+0x16e>
mov    0x2bbd(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10118,%rsp
mov    %rsi,%r14
lea    0x110(%rsp),%rdi
xor    %esi,%esi
mov    $0x10000,%edx
call   1080 <memset@plt>
mov    0x8(%r14),%rdi
lea    0xdfd(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    1226 <main+0x56>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xde1(%rip),%rsi
jmp    12b2 <main+0xe2>
mov    %rax,%rbx
lea    0xe04(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1090 <fscanf@plt>
mov    0x2d9c(%rip),%rbp
cmp    0x0(%rbp),%rax
je     1281 <main+0xb1>
lea    0xde3(%rip),%r15
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
movslq 0xc(%rsp),%rax
movb   $0x1,0x110(%rsp,%rax,1)
01
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1090 <fscanf@plt>
cmp    0x0(%rbp),%rax
jne    1260 <main+0x90>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x10(%r14),%rdi
lea    0xd6c(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    12c5 <main+0xf5>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xd85(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2d0a(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    %rax,%rbx
lea    0xd9c(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1090 <fscanf@plt>
cmp    0x0(%rbp),%rax
je     1311 <main+0x141>
lea    0xd82(%rip),%r14
lea    0xc(%rsp),%r15
xchg   %ax,%ax
movslq 0xc(%rsp),%rax
movb   $0x0,0x110(%rsp,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1090 <fscanf@plt>
cmp    0x0(%rbp),%rax
jne    12f0 <main+0x120>
mov    %rbx,%rdi
call   1050 <fclose@plt>
movb   $0x0,0x10f(%rsp)
mov    0x2cc0(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
call   10b0 <fgets@plt>
test   %rax,%rax
jne    134d <main+0x17d>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    0xce0(%rip),%r14
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%r15
lea    0xd0d(%rip),%r12
jmp    1395 <main+0x1c5>
nopw   0x0(%rax,%rax,1)
call   1030 <add_double_circle@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <printf@plt>
mov    0x0(%rbp),%edx
mov    %r13,%rdi
mov    $0xff,%esi
call   10b0 <fgets@plt>
test   %rax,%rax
je     133f <main+0x16f>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10d0 <sscanf@plt>
mov    %r13,%rdi
mov    $0x3a,%esi
call   10a0 <index@plt>
mov    %rax,%rbx
movslq 0xc(%rsp),%rax
cmpb   $0x0,0x110(%rsp,%rax,1)
je     1375 <main+0x1a5>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rbx,%rdi
cmp    $0x22,%eax
jg     1370 <main+0x1a0>
call   1040 <add_single_circle@plt>
jmp    1375 <main+0x1a5>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [50 x i8] c"ERROR - combining characters file %s not found.\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"%X\00"
@EOF = global i64 0
@.str.3 = [52 x i8] c"ERROR - nonprinting characters file %s not found.\0A\0A\00"
@.str.4 = [7 x i8] c"%X:%*s\00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [65536 x i8]
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [65536 x i8], [65536 x i8]* %9, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i32 0, i32 65536)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %10
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %26
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %2
br label %27
27: ; preds = %32, %26
%28 = load i32*, i32** %10
%29 = call i64 @fscanf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%30 = load i64, i64* @EOF
%31 = icmp ne i64 %29, %30
br i1 %31, label %32, label %36
32: ; preds = %27
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [65536 x i8], [65536 x i8]* %9, i64 0, i64 %34
store i8 1, i8* %35
br label %27
36: ; preds = %27
%37 = load i32*, i32** %10
%38 = call i32 @fclose(i32* %37)
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %42, i32** %10
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %52
44: ; preds = %36
%45 = load i32, i32* @stderr
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %48)
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %36
br label %53
53: ; preds = %58, %52
%54 = load i32*, i32** %10
%55 = call i64 @fscanf(i32* %54, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%56 = load i64, i64* @EOF
%57 = icmp ne i64 %55, %56
br i1 %57, label %58, label %62
58: ; preds = %53
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [65536 x i8], [65536 x i8]* %9, i64 0, i64 %60
store i8 0, i8* %61
br label %53
62: ; preds = %53
%63 = load i32*, i32** %10
%64 = call i32 @fclose(i32* %63)
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 255
store i8 0, i8* %65
br label %66
66: ; preds = %91, %62
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%68 = load i32, i32* @stdin
%69 = call i32* @fgets(i8* %67, i32 255, i32 %68)
%70 = icmp ne i32* %69, null
br i1 %70, label %71, label %94
71: ; preds = %66
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%73 = call i32 @sscanf(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%75 = call i8* @index(i8* %74, i8 signext 58)
%76 = getelementptr inbounds i8, i8* %75, i64 1
store i8* %76, i8** %8
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [65536 x i8], [65536 x i8]* %9, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = icmp ne i8 %80, 0
br i1 %81, label %82, label %91
82: ; preds = %71
%83 = load i8*, i8** %8
%84 = call i32 @strlen(i8* %83)
%85 = icmp slt i32 %84, 35
br i1 %85, label %86, label %88
86: ; preds = %82
%87 = load i8*, i8** %8
br label %90
88: ; preds = %82
%89 = load i8*, i8** %8
br label %90
90: ; preds = %88, %86
br label %91
91: ; preds = %90, %71
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%93 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %92)
br label %66
94: ; preds = %66
%95 = load i32, i32* @EXIT_SUCCESS
%96 = call i32 @exit(i32 %95)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [50 x i8] c"ERROR - combining characters file %s not found.\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"%X\00"
@EOF = global i64 0
@.str.3 = [52 x i8] c"ERROR - nonprinting characters file %s not found.\0A\0A\00"
@.str.4 = [7 x i8] c"%X:%*s\00"
@stdin = global i32 0
@.str.5 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = alloca [65536 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 65536)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %31, label %24
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %10
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %14, %24
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 %26
store i8 1, i8* %27
%28 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%29 = load i64, i64* @EOF
%30 = icmp eq i64 %28, %29
br i1 %30, label %31, label %24
31: ; preds = %24, %14
%32 = call i32 @fclose(i32* %12)
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%36 = icmp eq i32* %35, null
br i1 %36, label %41, label %37
37: ; preds = %31
%38 = call i64 @fscanf(i32* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%39 = load i64, i64* @EOF
%40 = icmp eq i64 %38, %39
br i1 %40, label %54, label %47
41: ; preds = %31
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %10
%44 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %37, %47
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 %49
store i8 0, i8* %50
%51 = call i64 @fscanf(i32* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%52 = load i64, i64* @EOF
%53 = icmp eq i64 %51, %52
br i1 %53, label %54, label %47
54: ; preds = %47, %37
%55 = call i32 @fclose(i32* %35)
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 255
store i8 0, i8* %56
%57 = load i32, i32* @stdin
%58 = call i32* @fgets(i8* %6, i32 255, i32 %57)
%59 = icmp eq i32* %58, null
br i1 %59, label %79, label %60
60: ; preds = %54, %74
%61 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%62 = call i8* @index(i8* %6, i8 signext 58)
%63 = getelementptr inbounds i8, i8* %62, i64 1
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, 0
br i1 %68, label %74, label %69
69: ; preds = %60
%70 = call i32 @strlen(i8* %63)
%71 = icmp slt i32 %70, 35
br i1 %71, label %72, label %73
72: ; preds = %69
br label %74
73: ; preds = %69
br label %74
74: ; preds = %72, %73, %60
%75 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%76 = load i32, i32* @stdin
%77 = call i32* @fgets(i8* %6, i32 255, i32 %76)
%78 = icmp eq i32* %77, null
br i1 %78, label %79, label %60
79: ; preds = %74, %54
%80 = load i32, i32* @EXIT_SUCCESS
%81 = call i32 @exit(i32 %80)
unreachable
}