#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int uniblocks(char *);
int unicat(char *);
int unifold_full(char *);
int uniwidth(char *);
int main(int argc, char *argv[]) {
  int rtn;
  if (argc != 5) {
    fprintf(stderr,
            "%s Blocks.txt UnicodeData.txt CaseFolding.txt EastAsianWidth.txt",
            argv[0]);
    return -1;
  }
  printf("/* Unicode facts */\n");
  printf("\n");
  printf("#include \"types.h\"\n");
  rtn = uniblocks(argv[1]);
  if (rtn)
    return rtn;
  rtn = unicat(argv[2]);
  if (rtn)
    return rtn;
  rtn = unifold_full(argv[3]);
  if (rtn)
    return rtn;
  rtn = uniwidth(argv[4]);
  if (rtn)
    return rtn;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     11a8 <main+0x48>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1267 <main+0x107>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <uniblocks@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11f1 <main+0x91>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1267 <main+0x107>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <unicat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1216 <main+0xb6>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1267 <main+0x107>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <unifold_full@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     123b <main+0xdb>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1267 <main+0x107>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1070 <uniwidth@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1260 <main+0x100>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1267 <main+0x107>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x5,%edi
jne    11c4 <main+0x54>
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rbx),%rdi
call   1050 <uniblocks@plt>
test   %eax,%eax
jne    11c2 <main+0x52>
mov    0x10(%rbx),%rdi
call   1070 <unicat@plt>
test   %eax,%eax
jne    11c2 <main+0x52>
mov    0x18(%rbx),%rdi
call   1090 <unifold_full@plt>
test   %eax,%eax
je     11e3 <main+0x73>
pop    %rbx
ret
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe29(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    0x20(%rbx),%rdi
pop    %rbx
jmp    1080 <uniwidth@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [65 x i8] c"%s Blocks.txt UnicodeData.txt CaseFolding.txt EastAsianWidth.txt\00"
@.str.1 = [21 x i8] c"/* Unicode facts */\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [20 x i8] c"#include \22types.h\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 5
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 -1, i32* %3
br label %55
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @uniblocks(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %15
%26 = load i32, i32* %6
store i32 %26, i32* %3
br label %55
27: ; preds = %15
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @unicat(i8* %30)
store i32 %31, i32* %6
%32 = load i32, i32* %6
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %27
%35 = load i32, i32* %6
store i32 %35, i32* %3
br label %55
36: ; preds = %27
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call i32 @unifold_full(i8* %39)
store i32 %40, i32* %6
%41 = load i32, i32* %6
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = load i32, i32* %6
store i32 %44, i32* %3
br label %55
45: ; preds = %36
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 4
%48 = load i8*, i8** %47
%49 = call i32 @uniwidth(i8* %48)
store i32 %49, i32* %6
%50 = load i32, i32* %6
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %45
%53 = load i32, i32* %6
store i32 %53, i32* %3
br label %55
54: ; preds = %45
store i32 0, i32* %3
br label %55
55: ; preds = %54, %52, %43, %34, %25, %9
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [65 x i8] c"%s Blocks.txt UnicodeData.txt CaseFolding.txt EastAsianWidth.txt\00"
@str = [20 x i8] c"/* Unicode facts */\00"
@str.4 = [19 x i8] c"#include \22types.h\22\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 5
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %30
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0))
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @uniblocks(i8* %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %8
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @unicat(i8* %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %16
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = tail call i32 @unifold_full(i8* %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = getelementptr inbounds i8*, i8** %1, i64 4
%28 = load i8*, i8** %27
%29 = tail call i32 @uniwidth(i8* %28)
br label %30
30: ; preds = %26, %21, %16, %8, %4
%31 = phi i32 [ -1, %4 ], [ %14, %8 ], [ %19, %16 ], [ %24, %21 ], [ %29, %26 ]
ret i32 %31
}