#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_h_code(int);
int /*<<< orphan*/ print_long_makeup_code(int);
int /*<<< orphan*/ print_makeup_code(int);
int /*<<< orphan*/ print_v_code(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  bool header;
  if (argc != 2) {
    fprintf(stderr, "wrong arg count\n");
    exit(2);
  }
  if (strcmp(argv[1], "-h") == 0)
    header = 1;
  else if (strcmp(argv[1], "-c") == 0)
    header = 0;
  else {
    fprintf(stderr, "wrong args\n");
    exit(2);
  }
  printf("/* This file is automatically generated; do not edit */\n");
  printf("\n");
  if (header) {
    printf("typedef struct\n");
    printf("{\n");
    printf("  uint32_t count;\n");
    printf("  uint32_t bits;\n");
    printf("} g4_bits;\n");
  } else {
    printf("#include <stdint.h>\n");
    printf("#include \"g4_tables.h\"\n");
  }
  printf("\n");
  print_long_makeup_code(header);
  printf("\n");
  print_makeup_code(header);
  printf("\n");
  print_h_code(header);
  printf("\n");
  print_v_code(header);
  exit(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   $0x2,-0x8(%rbp)
je     11bf <main+0x3f>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe43(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11e9 <main+0x69>
movl   $0x1,-0x14(%rbp)
jmp    1237 <main+0xb7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1213 <main+0x93>
movl   $0x0,-0x14(%rbp)
jmp    1232 <main+0xb2>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
lea    0xdf4(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
jmp    1237 <main+0xb7>
lea    0xde5(%rip),%rdi
call   1030 <printf@plt>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     129a <main+0x11a>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
lea    0xdf7(%rip),%rdi
call   1030 <printf@plt>
lea    0xdfe(%rip),%rdi
call   1030 <printf@plt>
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
jmp    12b2 <main+0x132>
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <print_long_makeup_code@plt>
lea    0xdfe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1040 <print_makeup_code@plt>
lea    0xdea(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1080 <print_h_code@plt>
lea    0xdd6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <print_v_code@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    1229 <main+0x99>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
lea    0xe66(%rip),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rbx
mov    $0x1,%r14d
test   %rax,%rax
je     11da <main+0x4a>
mov    0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1060 <strcmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
jne    12a5 <main+0x115>
lea    0xe42(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %rbx,%rbx
jne    123b <main+0xab>
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9a(%rip),%rbx
lea    0xe82(%rip),%rdi
jmp    1249 <main+0xb9>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xdc7(%rip),%rsi
jmp    12b5 <main+0x125>
lea    0xe2d(%rip),%rbx
lea    0xe12(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%edi
call   1070 <print_long_makeup_code@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%edi
call   1050 <print_makeup_code@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%edi
call   1090 <print_h_code@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%edi
call   10a0 <print_v_code@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    0x2d34(%rip),%rax
mov    (%rax),%edi
lea    0xd62(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"wrong arg count\0A\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [12 x i8] c"wrong args\0A\00"
@.str.4 = [57 x i8] c"/* This file is automatically generated; do not edit */\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [16 x i8] c"typedef struct\0A\00"
@.str.7 = [3 x i8] c"{\0A\00"
@.str.8 = [19 x i8] c" uint32_t count;\0A\00"
@.str.9 = [18 x i8] c" uint32_t bits;\0A\00"
@.str.10 = [12 x i8] c"} g4_bits;\0A\00"
@.str.11 = [21 x i8] c"#include <stdint.h>\0A\00"
@.str.12 = [24 x i8] c"#include \22g4_tables.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, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 2)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 1, i32* %6
br label %32
20: ; preds = %13
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %20
store i32 0, i32* %6
br label %31
27: ; preds = %20
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @exit(i32 2)
unreachable
31: ; preds = %26
br label %32
32: ; preds = %31, %19
%33 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%35 = load i32, i32* %6
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %32
%38 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
br label %46
43: ; preds = %32
%44 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
%45 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
br label %46
46: ; preds = %43, %37
%47 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%48 = load i32, i32* %6
%49 = call i32 @print_long_makeup_code(i32 %48)
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%51 = load i32, i32* %6
%52 = call i32 @print_makeup_code(i32 %51)
%53 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%54 = load i32, i32* %6
%55 = call i32 @print_h_code(i32 %54)
%56 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%57 = load i32, i32* %6
%58 = call i32 @print_v_code(i32 %57)
%59 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"wrong arg count\0A\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [12 x i8] c"wrong args\0A\00"
@str = [56 x i8] c"/* This file is automatically generated; do not edit */\00"
@str.13 = [20 x i8] c"#include <stdint.h>\00"
@str.14 = [23 x i8] c"#include \22g4_tables.h\22\00"
@str.15 = [15 x i8] c"typedef struct\00"
@str.16 = [2 x i8] c"{\00"
@str.17 = [18 x i8] c" uint32_t count;\00"
@str.18 = [17 x i8] c" uint32_t bits;\00"
@str.19 = [11 x i8] c"} g4_bits;\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 2)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %8
%14 = load i8*, i8** %9
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%20 = tail call i32 @exit(i32 2)
unreachable
21: ; preds = %13, %8
%22 = phi i32 [ 1, %8 ], [ 0, %13 ]
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%24 = tail call i32 @putchar(i32 10)
br i1 %12, label %25, label %29
25: ; preds = %21
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.15, i64 0, i64 0))
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.16, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.17, i64 0, i64 0))
br label %29
29: ; preds = %21, %25
%30 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.18, i64 0, i64 0), %25 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.13, i64 0, i64 0), %21 ]
%31 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.19, i64 0, i64 0), %25 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.14, i64 0, i64 0), %21 ]
%32 = tail call i32 @puts(i8* dereferenceable(1) %30)
%33 = tail call i32 @puts(i8* dereferenceable(1) %31)
%34 = tail call i32 @putchar(i32 10)
%35 = tail call i32 @print_long_makeup_code(i32 %22)
%36 = tail call i32 @putchar(i32 10)
%37 = tail call i32 @print_makeup_code(i32 %22)
%38 = tail call i32 @putchar(i32 10)
%39 = tail call i32 @print_h_code(i32 %22)
%40 = tail call i32 @putchar(i32 10)
%41 = tail call i32 @print_v_code(i32 %22)
%42 = tail call i32 @exit(i32 0)
unreachable
}