#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ decodeThrackleCode(unsigned short *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ help(char *);
#define no_argument 128
scalar_t__ readThrackleCode(unsigned short *, int *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ usage(char *);
int /*<<< orphan*/ writePlanarCode();
int main(int argc, char *argv[]) {
  int c;
  char *name = argv[0];
  static struct option long_options[] = {{"help", no_argument, NULL, 'h'}};
  int option_index = 0;
  while ((c = getopt_long(argc, argv, "h", long_options, &option_index)) !=
         -1) {
    switch (c) {
    case 'h':
      help(name);
      return EXIT_SUCCESS;
    case '?':
      usage(name);
      return EXIT_FAILURE;
    default:
      fprintf(stderr, "Illegal option %c.\n", c);
      usage(name);
      return EXIT_FAILURE;
    }
  }
  unsigned short code[(100 + (6 * 100 - 12) + 4)];
  int length;
  while (readThrackleCode(code, &length, stdin)) {
    decodeThrackleCode(code);
    writePlanarCode();
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe5c(%rip),%rdx
lea    0x2eb0(%rip),%rcx
lea    -0x24(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1256 <main+0xe6>
mov    -0x14(%rbp),%eax
mov    %eax,-0x598(%rbp)
sub    $0x3f,%eax
je     120a <main+0x9a>
jmp    11dc <main+0x6c>
mov    -0x598(%rbp),%eax
sub    $0x68,%eax
jne    1224 <main+0xb4>
jmp    11f0 <main+0x80>
mov    -0x20(%rbp),%rdi
call   1080 <help@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a5 <main+0x135>
mov    -0x20(%rbp),%rdi
call   1070 <usage@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a5 <main+0x135>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xdd0(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <usage@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12a5 <main+0x135>
jmp    125b <main+0xeb>
lea    -0x590(%rbp),%rdi
mov    0x2d7f(%rip),%rax
mov    (%rax),%edx
lea    -0x594(%rbp),%rsi
call   1090 <readThrackleCode@plt>
cmp    $0x0,%rax
je     1299 <main+0x129>
lea    -0x590(%rbp),%rdi
call   1050 <decodeThrackleCode@plt>
mov    $0x0,%al
call   1040 <writePlanarCode@plt>
jmp    125b <main+0xeb>
mov    0x2d28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x580,%rsp
mov    (%rsi),%rbx
movl   $0x0,0xc(%rsp)
lea    0xe77(%rip),%rdx
lea    0x2ecb(%rip),%rcx
lea    0xc(%rsp),%r8
call   1030 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     11b8 <main+0x48>
cmp    $0x3f,%eax
je     1222 <main+0xb2>
cmp    $0x68,%eax
jne    120b <main+0x9b>
mov    %rbx,%rdi
call   1080 <help@plt>
jmp    1202 <main+0x92>
mov    0x2e29(%rip),%r15
mov    (%r15),%edx
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1090 <readThrackleCode@plt>
test   %rax,%rax
je     1202 <main+0x92>
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
call   1050 <decodeThrackleCode@plt>
xor    %eax,%eax
call   1040 <writePlanarCode@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <readThrackleCode@plt>
test   %rax,%rax
jne    11e0 <main+0x70>
mov    0x2dbf(%rip),%rax
jmp    1231 <main+0xc1>
mov    0x2dc6(%rip),%rcx
mov    (%rcx),%edi
lea    0xdec(%rip),%rsi
mov    %eax,%edx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <usage@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%eax
add    $0x580,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@main.long_options = internal global [1 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 104 }]
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.2 = [20 x i8] c"Illegal option %c.\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [692 x i16]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
store i8* %13, i8** %7
store i32 0, i32* %8
br label %14
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @getopt_long(i32 %15, i8** %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([1 x %struct.option], [1 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %8)
store i32 %17, i32* %6
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %36
19: ; preds = %14
%20 = load i32, i32* %6
switch i32 %20, label %29 [
i32 104, label %21
i32 63, label %25
]
21: ; preds = %19
%22 = load i8*, i8** %7
%23 = call i32 @help(i8* %22)
%24 = load i32, i32* @EXIT_SUCCESS
store i32 %24, i32* %3
br label %48
25: ; preds = %19
%26 = load i8*, i8** %7
%27 = call i32 @usage(i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
store i32 %28, i32* %3
br label %48
29: ; preds = %19
%30 = load i32, i32* @stderr
%31 = load i32, i32* %6
%32 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = load i8*, i8** %7
%34 = call i32 @usage(i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
store i32 %35, i32* %3
br label %48
36: ; preds = %14
br label %37
37: ; preds = %42, %36
%38 = getelementptr inbounds [692 x i16], [692 x i16]* %9, i64 0, i64 0
%39 = load i32, i32* @stdin
%40 = call i64 @readThrackleCode(i16* %38, i32* %10, i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %37
%43 = getelementptr inbounds [692 x i16], [692 x i16]* %9, i64 0, i64 0
%44 = call i32 @decodeThrackleCode(i16* %43)
%45 = call i32 (...) @writePlanarCode()
br label %37
46: ; preds = %37
%47 = load i32, i32* @EXIT_SUCCESS
store i32 %47, i32* %3
br label %48
48: ; preds = %46, %29, %25, %21
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@main.long_options = internal global [1 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 104 }]
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.2 = [20 x i8] c"Illegal option %c.\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [692 x i16]
%5 = alloca i32
%6 = load i8*, i8** %1
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([1 x %struct.option], [1 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %3)
switch i32 %8, label %15 [
i32 -1, label %20
i32 104, label %9
i32 63, label %12
]
9: ; preds = %2
%10 = call i32 @help(i8* %6)
%11 = load i32, i32* @EXIT_SUCCESS
br label %35
12: ; preds = %2
%13 = call i32 @usage(i8* %6)
%14 = load i32, i32* @EXIT_FAILURE
br label %35
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%18 = call i32 @usage(i8* %6)
%19 = load i32, i32* @EXIT_FAILURE
br label %35
20: ; preds = %2
%21 = bitcast [692 x i16]* %4 to i8*
%22 = bitcast i32* %5 to i8*
%23 = getelementptr inbounds [692 x i16], [692 x i16]* %4, i64 0, i64 0
%24 = load i32, i32* @stdin
%25 = call i64 @readThrackleCode(i16* %23, i32* %5, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %20, %27
%28 = call i32 @decodeThrackleCode(i16* %23)
%29 = call i32 (...) @writePlanarCode()
%30 = load i32, i32* @stdin
%31 = call i64 @readThrackleCode(i16* %23, i32* %5, i32 %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %27
33: ; preds = %27, %20
%34 = load i32, i32* @EXIT_SUCCESS
br label %35
35: ; preds = %33, %15, %12, %9
%36 = phi i32 [ %19, %15 ], [ %14, %12 ], [ %11, %9 ], [ %34, %33 ]
ret i32 %36
}