#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 atoi(char *);
int /*<<< orphan*/ decodePlanarCode(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
int optind;
scalar_t__ readPlanarCode(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 graphsRead = 0;
  int graphsWritten = 0;
  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;
    }
  }
  if (argc - optind != 1) {
    usage(name);
    return EXIT_FAILURE;
  }
  int copies = atoi(argv[optind]);
  unsigned short code[(200 + (6 * 200 - 12) + 3)];
  int length, i;
  while (readPlanarCode(code, &length, stdin)) {
    decodePlanarCode(code);
    graphsRead++;
    for (i = 0; i < copies; i++) {
      graphsWritten++;
      writePlanarCode();
    }
  }
  fprintf(stderr, "Read %d graph%s.\n", graphsRead, graphsRead == 1 ? "" : "s");
  fprintf(stderr, "Written %d graph%s.\n", graphsWritten,
          graphsWritten == 1 ? "" : "s");
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe3e(%rip),%rdx
lea    0x2ea2(%rip),%rcx
lea    -0x2c(%rbp),%r8
call   1040 <getopt_long@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     1276 <main+0xf6>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xb1c(%rbp)
sub    $0x3f,%eax
je     1228 <main+0xa8>
jmp    11fa <main+0x7a>
mov    -0xb1c(%rbp),%eax
sub    $0x68,%eax
jne    1242 <main+0xc2>
jmp    120e <main+0x8e>
mov    -0x28(%rbp),%rdi
call   1080 <help@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x22c>
mov    -0x28(%rbp),%rdi
call   1070 <usage@plt>
mov    0x2d90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x22c>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xdb2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <usage@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x22c>
mov    -0x8(%rbp),%eax
mov    0x2d60(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
je     12a5 <main+0x125>
mov    -0x28(%rbp),%rdi
call   1070 <usage@plt>
mov    0x2d2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x22c>
mov    -0x10(%rbp),%rax
mov    0x2d30(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x30(%rbp)
lea    -0xb10(%rbp),%rdi
mov    0x2d1b(%rip),%rax
mov    (%rax),%edx
lea    -0xb14(%rbp),%rsi
call   10a0 <readPlanarCode@plt>
cmp    $0x0,%rax
je     133c <main+0x1bc>
lea    -0xb10(%rbp),%rdi
call   1030 <decodePlanarCode@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0xb18(%rbp)
mov    -0xb18(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1337 <main+0x1b7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <writePlanarCode@plt>
mov    -0xb18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb18(%rbp)
jmp    1304 <main+0x184>
jmp    12bf <main+0x13f>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%esi
lea    0xcdb(%rip),%rcx
lea    0xcc1(%rip),%rax
cmp    $0x1,%esi
cmove  %rax,%rcx
lea    0xcb4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%esi
lea    0xca9(%rip),%rcx
lea    0xc8f(%rip),%rax
cmp    $0x1,%esi
cmove  %rax,%rcx
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xaf8,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
mov    (%rsi),%r14
movl   $0x0,0xc(%rsp)
lea    0xe5d(%rip),%rdx
lea    0x2ec1(%rip),%rcx
lea    0xc(%rsp),%r8
call   1040 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     11dd <main+0x5d>
cmp    $0x3f,%eax
je     128a <main+0x10a>
cmp    $0x68,%eax
jne    1271 <main+0xf1>
mov    %r14,%rdi
call   1080 <help@plt>
jmp    131c <main+0x19c>
mov    0x2dfc(%rip),%rax
movslq (%rax),%rax
sub    %eax,%ebx
cmp    $0x1,%ebx
jne    128a <main+0x10a>
mov    0x0(%rbp,%rax,8),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebp
mov    0x2de3(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   10a0 <readPlanarCode@plt>
test   %rax,%rax
je     12d9 <main+0x159>
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%r15
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    124d <main+0xcd>
lea    0x1(%r13),%ebx
mov    0x2dad(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   10a0 <readPlanarCode@plt>
test   %rax,%rax
je     129e <main+0x11e>
mov    %ebx,%r13d
mov    %r12,%rdi
call   1030 <decodePlanarCode@plt>
test   %ebp,%ebp
jle    1230 <main+0xb0>
mov    %ebp,%ebx
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <writePlanarCode@plt>
add    $0xffffffff,%ebx
jne    1260 <main+0xe0>
add    %ebp,%r14d
jmp    1230 <main+0xb0>
mov    0x2d58(%rip),%rcx
mov    (%rcx),%edi
lea    0xd86(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1070 <usage@plt>
mov    0x2d2f(%rip),%rax
jmp    1323 <main+0x1a3>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
test   %r13d,%r13d
lea    0xd69(%rip),%r15
lea    0xd75(%rip),%rbp
mov    %rbp,%rcx
cmove  %r15,%rcx
lea    0xd55(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    $0x1,%r14d
cmove  %r15,%rbp
jmp    12ff <main+0x17f>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
lea    0xd32(%rip),%rsi
lea    0xd3d(%rip),%rbp
xor    %r14d,%r14d
xor    %edx,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
lea    0xd20(%rip),%rsi
mov    %r14d,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2c9d(%rip),%rax
mov    (%rax),%eax
add    $0xaf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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"
@optind = global i32 0
@stdin = global i32 0
@.str.3 = [18 x i8] c"Read %d graph%s.\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c"s\00"
@.str.6 = [21 x i8] c"Written %d graph%s.\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 i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1391 x i16]
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
store i8* %17, i8** %9
store i32 0, i32* %10
br label %18
18: ; preds = %2
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call i32 @getopt_long(i32 %19, i8** %20, 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* %10)
store i32 %21, i32* %8
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %40
23: ; preds = %18
%24 = load i32, i32* %8
switch i32 %24, label %33 [
i32 104, label %25
i32 63, label %29
]
25: ; preds = %23
%26 = load i8*, i8** %9
%27 = call i32 @help(i8* %26)
%28 = load i32, i32* @EXIT_SUCCESS
store i32 %28, i32* %3
br label %94
29: ; preds = %23
%30 = load i8*, i8** %9
%31 = call i32 @usage(i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
store i32 %32, i32* %3
br label %94
33: ; preds = %23
%34 = load i32, i32* @stderr
%35 = load i32, i32* %8
%36 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = load i8*, i8** %9
%38 = call i32 @usage(i8* %37)
%39 = load i32, i32* @EXIT_FAILURE
store i32 %39, i32* %3
br label %94
40: ; preds = %18
%41 = load i32, i32* %4
%42 = load i32, i32* @optind
%43 = sub nsw i32 %41, %42
%44 = icmp ne i32 %43, 1
br i1 %44, label %45, label %49
45: ; preds = %40
%46 = load i8*, i8** %9
%47 = call i32 @usage(i8* %46)
%48 = load i32, i32* @EXIT_FAILURE
store i32 %48, i32* %3
br label %94
49: ; preds = %40
%50 = load i8**, i8*** %5
%51 = load i32, i32* @optind
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = call i32 @atoi(i8* %54)
store i32 %55, i32* %11
br label %56
56: ; preds = %77, %49
%57 = getelementptr inbounds [1391 x i16], [1391 x i16]* %12, i64 0, i64 0
%58 = load i32, i32* @stdin
%59 = call i64 @readPlanarCode(i16* %57, i32* %13, i32 %58)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %78
61: ; preds = %56
%62 = getelementptr inbounds [1391 x i16], [1391 x i16]* %12, i64 0, i64 0
%63 = call i32 @decodePlanarCode(i16* %62)
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
store i32 0, i32* %14
br label %66
66: ; preds = %74, %61
%67 = load i32, i32* %14
%68 = load i32, i32* %11
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %77
70: ; preds = %66
%71 = load i32, i32* %7
%72 = add nsw i32 %71, 1
store i32 %72, i32* %7
%73 = call i32 (...) @writePlanarCode()
br label %74
74: ; preds = %70
%75 = load i32, i32* %14
%76 = add nsw i32 %75, 1
store i32 %76, i32* %14
br label %66
77: ; preds = %66
br label %56
78: ; preds = %56
%79 = load i32, i32* @stderr
%80 = load i32, i32* %6
%81 = load i32, i32* %6
%82 = icmp eq i32 %81, 1
%83 = zext i1 %82 to i64
%84 = select i1 %82, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%85 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %80, i8* %84)
%86 = load i32, i32* @stderr
%87 = load i32, i32* %7
%88 = load i32, i32* %7
%89 = icmp eq i32 %88, 1
%90 = zext i1 %89 to i64
%91 = select i1 %89, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%92 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %87, i8* %91)
%93 = load i32, i32* @EXIT_SUCCESS
store i32 %93, i32* %3
br label %94
94: ; preds = %78, %45, %33, %29, %25
%95 = load i32, i32* %3
ret i32 %95
}

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"
@optind = global i32 0
@stdin = global i32 0
@.str.3 = [18 x i8] c"Read %d graph%s.\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c"s\00"
@.str.6 = [21 x i8] c"Written %d graph%s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [1391 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 %73
12: ; preds = %2
%13 = call i32 @usage(i8* %6)
%14 = load i32, i32* @EXIT_FAILURE
br label %73
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, 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 %73
20: ; preds = %2
%21 = load i32, i32* @optind
%22 = sub nsw i32 %0, %21
%23 = icmp eq i32 %22, 1
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = call i32 @usage(i8* %6)
%26 = load i32, i32* @EXIT_FAILURE
br label %73
27: ; preds = %20
%28 = sext i32 %21 to i64
%29 = getelementptr inbounds i8*, i8** %1, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
%32 = bitcast [1391 x i16]* %4 to i8*
%33 = bitcast i32* %5 to i8*
%34 = getelementptr inbounds [1391 x i16], [1391 x i16]* %4, i64 0, i64 0
%35 = load i32, i32* @stdin
%36 = call i64 @readPlanarCode(i16* %34, i32* %5, i32 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %27
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %67
41: ; preds = %27
%42 = icmp sgt i32 %31, 0
br label %50
43: ; preds = %55
%44 = add i32 %31, %52
br label %45
45: ; preds = %43, %50
%46 = phi i32 [ %52, %50 ], [ %44, %43 ]
%47 = load i32, i32* @stdin
%48 = call i64 @readPlanarCode(i16* %34, i32* %5, i32 %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %60, label %50
50: ; preds = %41, %45
%51 = phi i32 [ 0, %41 ], [ %54, %45 ]
%52 = phi i32 [ 0, %41 ], [ %46, %45 ]
%53 = call i32 @decodePlanarCode(i16* %34)
%54 = add nuw nsw i32 %51, 1
br i1 %42, label %55, label %45
55: ; preds = %50, %55
%56 = phi i32 [ %58, %55 ], [ 0, %50 ]
%57 = call i32 (...) @writePlanarCode()
%58 = add nuw nsw i32 %56, 1
%59 = icmp eq i32 %58, %31
br i1 %59, label %43, label %55
60: ; preds = %45
%61 = load i32, i32* @stderr
%62 = icmp eq i32 %51, 0
%63 = select i1 %62, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%64 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %54, i8* %63)
%65 = icmp eq i32 %46, 1
%66 = select i1 %65, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
br label %67
67: ; preds = %60, %38
%68 = phi i32 [ 0, %38 ], [ %46, %60 ]
%69 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %38 ], [ %66, %60 ]
%70 = load i32, i32* @stderr
%71 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %68, i8* %69)
%72 = load i32, i32* @EXIT_SUCCESS
br label %73
73: ; preds = %67, %24, %15, %12, %9
%74 = phi i32 [ %19, %15 ], [ %14, %12 ], [ %11, %9 ], [ %26, %24 ], [ %72, %67 ]
ret i32 %74
}