#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*/ CSystem(char *);
int /*<<< orphan*/ Error();
char *FixExtension(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  int Counter, End, NumPDMFile = 0;
  enum { Init, OptionF, OptionO } State;
  char File[50], PDMFileName[20][50], CDBFileName[50], OutputFileName[50],
      DummyString[50], Command[256];
  if (argc == 1)
    Error();
  strcpy(CDBFileName, FixExtension(argv[argc - 1], "cdb"));
  for (Counter = 0; Counter <= (strlen(CDBFileName) - 5); Counter++)
    File[Counter] = CDBFileName[Counter];
  File[Counter] = '\0';
  strcpy(OutputFileName, File);
  strcat(OutputFileName, ".c");
  strcpy(PDMFileName[0], File);
  strcat(PDMFileName[0], ".pdm");
  End = argc - 2;
  State = Init;
  for (Counter = 1; Counter <= End; Counter++) {
    if (strcmp(argv[Counter], "-f") == 0) {
      if (State != Init)
        Error();
      State = OptionF;
    } else if (strcmp(argv[Counter], "-o") == 0) {
      if (Counter + 1 != End)
        Error();
      State = OptionO;
    } else {
      if (argv[Counter][0] == '-')
        Error();
      if (State == Init)
        Error();
      if (State == OptionF) {
        NumPDMFile++;
        strcpy(PDMFileName[NumPDMFile], FixExtension(argv[Counter], "pdm"));
      } else
        strcpy(OutputFileName, FixExtension(argv[Counter], "c"));
    }
  }
  fprintf(stderr, "CDB Compiler - Version 2.1\n");
  fprintf(stderr, "--------------------------\n");
  fprintf(stderr, "checking syntax.\n");
  sprintf(Command, "echo %d > cdbc.pdm.number", NumPDMFile);
  CSystem(Command);
  if (NumPDMFile == 0) {
    fprintf(stderr, "   %s\n", PDMFileName[0]);
    sprintf(Command, "./PDMParser < %s > cdbc.pdm.input0", PDMFileName[0]);
    CSystem(Command);
  } else {
    for (Counter = 1; Counter <= NumPDMFile; Counter++) {
      fprintf(stderr, "   %s\n", PDMFileName[Counter]);
      sprintf(Command, "./PDMParser < %s > cdbc.pdm.input%d",
              PDMFileName[Counter], Counter);
      CSystem(Command);
    }
  }
  fprintf(stderr, "   %s\n", CDBFileName);
  sprintf(Command, "./CDBParser < %s > cdbc.cdb.input", CDBFileName);
  CSystem(Command);
  CSystem("sbcl --noinform --load CDBRun");
  sprintf(Command, "indent cdbc.output -kr -o %s", OutputFileName);
  CSystem(Command);
  CSystem("rm cdbc.pdm.*");
  CSystem("rm cdbc.cdb.*");
  CSystem("rm cdbc.output");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x630,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11c1 <main+0x31>
mov    $0x0,%al
call   1060 <Error@plt>
lea    -0x490(%rbp),%rax
mov    %rax,-0x618(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe19(%rip),%rsi
call   10b0 <FixExtension@plt>
mov    -0x618(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x61c(%rbp)
lea    -0x490(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x61c(%rbp),%eax
sub    $0x5,%ecx
cmp    %ecx,%eax
jg     124b <main+0xbb>
movslq -0x14(%rbp),%rax
mov    -0x490(%rbp,%rax,1),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1202 <main+0x72>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x4d0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x4d0(%rbp),%rdi
lea    0xd92(%rip),%rsi
call   1090 <strcat@plt>
lea    -0x450(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x450(%rbp),%rdi
lea    0xd72(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     141a <main+0x28a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd3c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12fc <main+0x16c>
cmpl   $0x0,-0x20(%rbp)
je     12f0 <main+0x160>
mov    $0x0,%al
call   1060 <Error@plt>
movl   $0x1,-0x20(%rbp)
jmp    1407 <main+0x277>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd00(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1340 <main+0x1b0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0x18(%rbp),%eax
je     1334 <main+0x1a4>
mov    $0x0,%al
call   1060 <Error@plt>
movl   $0x2,-0x20(%rbp)
jmp    1402 <main+0x272>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    135f <main+0x1cf>
mov    $0x0,%al
call   1060 <Error@plt>
cmpl   $0x0,-0x20(%rbp)
jne    1370 <main+0x1e0>
mov    $0x0,%al
call   1060 <Error@plt>
cmpl   $0x1,-0x20(%rbp)
jne    13c8 <main+0x238>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rcx
lea    -0x450(%rbp),%rax
imul   $0x32,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x628(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc59(%rip),%rsi
call   10b0 <FixExtension@plt>
mov    -0x628(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
jmp    13fd <main+0x26d>
lea    -0x4d0(%rbp),%rax
mov    %rax,-0x630(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc1c(%rip),%rsi
call   10b0 <FixExtension@plt>
mov    -0x630(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
jmp    1402 <main+0x272>
jmp    1407 <main+0x277>
jmp    140c <main+0x27c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12b1 <main+0x121>
mov    0x2bbf(%rip),%rax
mov    (%rax),%edi
lea    0xbe8(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
lea    0xbed(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2b91(%rip),%rax
mov    (%rax),%edi
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x610(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xbec(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x610(%rbp),%rdi
call   1040 <CSystem@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    14d8 <main+0x348>
mov    0x2b4c(%rip),%rax
mov    (%rax),%edi
lea    -0x450(%rbp),%rdx
lea    0xbd2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x610(%rbp),%rdi
lea    -0x450(%rbp),%rdx
lea    0xbbd(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x610(%rbp),%rdi
call   1040 <CSystem@plt>
jmp    155d <main+0x3cd>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1558 <main+0x3c8>
mov    0x2aee(%rip),%rax
mov    (%rax),%edi
movslq -0x14(%rbp),%rax
lea    -0x450(%rbp),%rdx
imul   $0x32,%rax,%rax
add    %rax,%rdx
lea    0xb69(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x610(%rbp),%rdi
movslq -0x14(%rbp),%rax
lea    -0x450(%rbp),%rdx
imul   $0x32,%rax,%rax
add    %rax,%rdx
mov    -0x14(%rbp),%ecx
lea    0xb69(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x610(%rbp),%rdi
call   1040 <CSystem@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    14df <main+0x34f>
jmp    155d <main+0x3cd>
mov    0x2a7c(%rip),%rax
mov    (%rax),%edi
lea    -0x490(%rbp),%rdx
lea    0xb02(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x610(%rbp),%rdi
lea    -0x490(%rbp),%rdx
lea    0xb34(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x610(%rbp),%rdi
call   1040 <CSystem@plt>
lea    0xb3c(%rip),%rdi
call   1040 <CSystem@plt>
lea    -0x610(%rbp),%rdi
lea    -0x4d0(%rbp),%rdx
lea    0xb40(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x610(%rbp),%rdi
call   1040 <CSystem@plt>
lea    0xb43(%rip),%rdi
call   1040 <CSystem@plt>
lea    0xb45(%rip),%rdi
call   1040 <CSystem@plt>
lea    0xb47(%rip),%rdi
call   1040 <CSystem@plt>
mov    -0x4(%rbp),%eax
add    $0x630,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x5b8,%rsp
mov    %rsi,%r12
mov    %edi,%r15d
cmp    $0x1,%edi
jne    11b3 <main+0x23>
xor    %eax,%eax
call   1060 <Error@plt>
lea    -0x1(%r15),%ebp
movslq %ebp,%rax
mov    (%r12,%rax,8),%rdi
lea    0xe3b(%rip),%rsi
call   10b0 <FixExtension@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
xor    %r14d,%r14d
cmp    $0x5,%eax
mov    %ebp,0x8(%rsp)
jge    11f2 <main+0x62>
xor    %ebp,%ebp
jmp    1225 <main+0x95>
xor    %ebx,%ebx
lea    0x10(%rsp),%r13
nopl   0x0(%rax)
movzbl 0x10(%rsp,%rbx,1),%eax
mov    %al,0x90(%rsp,%rbx,1)
lea    0x1(%rbx),%rbp
mov    %r13,%rdi
call   1050 <strlen@plt>
add    $0xfffffffb,%eax
cltq
cmp    %rax,%rbx
mov    %rbp,%rbx
jl     1200 <main+0x70>
movb   $0x0,0x90(%rsp,%rbp,1)
lea    0x50(%rsp),%rbp
lea    0x90(%rsp),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xdb8(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcat@plt>
lea    0x1d0(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xd99(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcat@plt>
cmp    $0x3,%r15d
jge    1360 <main+0x1d0>
mov    0x2d59(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xd81(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xd8c(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xd97(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xd9b(%rip),%rsi
lea    0xd0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <CSystem@plt>
test   %r14d,%r14d
je     147c <main+0x2ec>
mov    %r14,%r15
mov    %rbp,%r14
jle    14bf <main+0x32f>
add    $0x1,%r15d
lea    0x202(%rsp),%rbx
mov    $0x1,%ebp
lea    0xd95(%rip),%r12
lea    0xd0(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14),%edi
lea    0xd4c(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %r13,%rdi
call   1040 <CSystem@plt>
add    $0x1,%rbp
add    $0x32,%rbx
cmp    %rbp,%r15
jne    1320 <main+0x190>
jmp    14bf <main+0x32f>
add    $0xfffffffe,%r15d
mov    0x8(%rsp),%r13d
add    $0xfffffffffffffffe,%r15
mov    %r15,0x8(%rsp)
add    $0xffffffffffffffff,%r13
lea    0xc8f(%rip),%rbx
xor    %r15d,%r15d
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    13cb <main+0x23b>
add    $0x1,%r14d
movslq %r14d,%rax
imul   $0x32,%rax,%rax
lea    (%rsp,%rax,1),%rbp
add    $0x1d0,%rbp
mov    0x8(%r12,%r15,8),%rdi
lea    0xc5f(%rip),%rsi
call   10b0 <FixExtension@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    $0x1,%ebp
add    $0x1,%r15
cmp    %r15,%r13
je     1280 <main+0xf0>
mov    0x8(%r12,%r15,8),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1440 <main+0x2b0>
mov    0x8(%r12,%r15,8),%rdi
lea    0xc26(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1460 <main+0x2d0>
mov    0x8(%r12,%r15,8),%rax
cmpb   $0x2d,(%rax)
jne    1404 <main+0x274>
xor    %eax,%eax
call   1060 <Error@plt>
cmp    $0x1,%ebp
je     1387 <main+0x1f7>
test   %ebp,%ebp
jne    1418 <main+0x288>
xor    %eax,%eax
call   1060 <Error@plt>
mov    0x8(%r12,%r15,8),%rdi
lea    0xbe1(%rip),%rsi
call   10b0 <FixExtension@plt>
lea    0x50(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
jmp    13be <main+0x22e>
nopl   0x0(%rax,%rax,1)
test   %ebp,%ebp
je     13b9 <main+0x229>
xor    %eax,%eax
call   1060 <Error@plt>
jmp    13b9 <main+0x229>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2,%ebp
cmp    %r15,0x8(%rsp)
je     13be <main+0x22e>
xor    %eax,%eax
call   1060 <Error@plt>
jmp    13be <main+0x22e>
mov    0x0(%rbp),%edi
lea    0xbf0(%rip),%rsi
lea    0x1d0(%rsp),%r14
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xbde(%rip),%rsi
lea    0xd0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <CSystem@plt>
mov    %rbp,%r14
mov    (%r14),%edi
lea    0xbad(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xbe5(%rip),%rsi
lea    0xd0(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
call   1040 <CSystem@plt>
lea    0xbe3(%rip),%rdi
call   1040 <CSystem@plt>
lea    0xbf5(%rip),%rsi
lea    0x50(%rsp),%rdx
mov    %rbp,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbp,%rdi
call   1040 <CSystem@plt>
lea    0xbf4(%rip),%rdi
call   1040 <CSystem@plt>
lea    0xbf6(%rip),%rdi
call   1040 <CSystem@plt>
lea    0xbf8(%rip),%rdi
call   1040 <CSystem@plt>
xor    %eax,%eax
add    $0x5b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cdb\00"
@.str.1 = [3 x i8] c".c\00"
@.str.2 = [5 x i8] c".pdm\00"
@.str.3 = [3 x i8] c"-f\00"
@.str.4 = [3 x i8] c"-o\00"
@.str.5 = [4 x i8] c"pdm\00"
@.str.6 = [2 x i8] c"c\00"
@stderr = global i32 0
@.str.7 = [28 x i8] c"CDB Compiler - Version 2.1\0A\00"
@.str.8 = [28 x i8] c"--------------------------\0A\00"
@.str.9 = [18 x i8] c"checking syntax.\0A\00"
@.str.10 = [26 x i8] c"echo %d > cdbc.pdm.number\00"
@.str.11 = [7 x i8] c" %s\0A\00"
@.str.12 = [35 x i8] c"./PDMParser < %s > cdbc.pdm.input0\00"
@.str.13 = [36 x i8] c"./PDMParser < %s > cdbc.pdm.input%d\00"
@.str.14 = [34 x i8] c"./CDBParser < %s > cdbc.cdb.input\00"
@.str.15 = [30 x i8] c"sbcl --noinform --load CDBRun\00"
@.str.16 = [29 x i8] c"indent cdbc.output -kr -o %s\00"
@.str.17 = [14 x i8] c"rm cdbc.pdm.*\00"
@.str.18 = [14 x i8] c"rm cdbc.cdb.*\00"
@.str.19 = [15 x i8] c"rm cdbc.output\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 i32
%10 = alloca [50 x i8]
%11 = alloca [20 x [50 x i8]]
%12 = alloca [50 x i8]
%13 = alloca [50 x i8]
%14 = alloca [50 x i8]
%15 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (...) @Error()
br label %20
20: ; preds = %18, %2
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %12, i64 0, i64 0
%22 = load i8**, i8*** %5
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %22, i64 %25
%27 = load i8*, i8** %26
%28 = call i8* @FixExtension(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @strcpy(i8* %21, i8* %28)
store i32 0, i32* %6
br label %30
30: ; preds = %44, %20
%31 = load i32, i32* %6
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %12, i64 0, i64 0
%33 = call i32 @strlen(i8* %32)
%34 = sub nsw i32 %33, 5
%35 = icmp sle i32 %31, %34
br i1 %35, label %36, label %47
36: ; preds = %30
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %12, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 %42
store i8 %40, i8* %43
br label %44
44: ; preds = %36
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %30
47: ; preds = %30
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 %49
store i8 0, i8* %50
%51 = getelementptr inbounds [50 x i8], [50 x i8]* %13, i64 0, i64 0
%52 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%53 = call i32 @strcpy(i8* %51, i8* %52)
%54 = getelementptr inbounds [50 x i8], [50 x i8]* %13, i64 0, i64 0
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%56 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %11, i64 0, i64 0
%57 = getelementptr inbounds [50 x i8], [50 x i8]* %56, i64 0, i64 0
%58 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%59 = call i32 @strcpy(i8* %57, i8* %58)
%60 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %11, i64 0, i64 0
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %60, i64 0, i64 0
%62 = call i32 @strcat(i8* %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%63 = load i32, i32* %4
%64 = sub nsw i32 %63, 2
store i32 %64, i32* %7
store i32 0, i32* %9
store i32 1, i32* %6
br label %65
65: ; preds = %145, %47
%66 = load i32, i32* %6
%67 = load i32, i32* %7
%68 = icmp sle i32 %66, %67
br i1 %68, label %69, label %148
69: ; preds = %65
%70 = load i8**, i8*** %5
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %70, i64 %72
%74 = load i8*, i8** %73
%75 = call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %83
77: ; preds = %69
%78 = load i32, i32* %9
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %77
%81 = call i32 (...) @Error()
br label %82
82: ; preds = %80, %77
store i32 1, i32* %9
br label %144
83: ; preds = %69
%84 = load i8**, i8*** %5
%85 = load i32, i32* %6
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %84, i64 %86
%88 = load i8*, i8** %87
%89 = call i64 @strcmp(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %99
91: ; preds = %83
%92 = load i32, i32* %6
%93 = add nsw i32 %92, 1
%94 = load i32, i32* %7
%95 = icmp ne i32 %93, %94
br i1 %95, label %96, label %98
96: ; preds = %91
%97 = call i32 (...) @Error()
br label %98
98: ; preds = %96, %91
store i32 2, i32* %9
br label %143
99: ; preds = %83
%100 = load i8**, i8*** %5
%101 = load i32, i32* %6
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8*, i8** %100, i64 %102
%104 = load i8*, i8** %103
%105 = getelementptr inbounds i8, i8* %104, i64 0
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 45
br i1 %108, label %109, label %111
109: ; preds = %99
%110 = call i32 (...) @Error()
br label %111
111: ; preds = %109, %99
%112 = load i32, i32* %9
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %116
114: ; preds = %111
%115 = call i32 (...) @Error()
br label %116
116: ; preds = %114, %111
%117 = load i32, i32* %9
%118 = icmp eq i32 %117, 1
br i1 %118, label %119, label %133
119: ; preds = %116
%120 = load i32, i32* %8
%121 = add nsw i32 %120, 1
store i32 %121, i32* %8
%122 = load i32, i32* %8
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %11, i64 0, i64 %123
%125 = getelementptr inbounds [50 x i8], [50 x i8]* %124, i64 0, i64 0
%126 = load i8**, i8*** %5
%127 = load i32, i32* %6
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8*, i8** %126, i64 %128
%130 = load i8*, i8** %129
%131 = call i8* @FixExtension(i8* %130, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%132 = call i32 @strcpy(i8* %125, i8* %131)
br label %142
133: ; preds = %116
%134 = getelementptr inbounds [50 x i8], [50 x i8]* %13, i64 0, i64 0
%135 = load i8**, i8*** %5
%136 = load i32, i32* %6
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8*, i8** %135, i64 %137
%139 = load i8*, i8** %138
%140 = call i8* @FixExtension(i8* %139, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%141 = call i32 @strcpy(i8* %134, i8* %140)
br label %142
142: ; preds = %133, %119
br label %143
143: ; preds = %142, %98
br label %144
144: ; preds = %143, %82
br label %145
145: ; preds = %144
%146 = load i32, i32* %6
%147 = add nsw i32 %146, 1
store i32 %147, i32* %6
br label %65
148: ; preds = %65
%149 = load i32, i32* @stderr
%150 = call i32 (i32, i8*, ...) @fprintf(i32 %149, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%151 = load i32, i32* @stderr
%152 = call i32 (i32, i8*, ...) @fprintf(i32 %151, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%153 = load i32, i32* @stderr
%154 = call i32 (i32, i8*, ...) @fprintf(i32 %153, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%155 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%156 = load i32, i32* %8
%157 = call i32 (i8*, i8*, ...) @sprintf(i8* %155, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %156)
%158 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%159 = call i32 @CSystem(i8* %158)
%160 = load i32, i32* %8
%161 = icmp eq i32 %160, 0
br i1 %161, label %162, label %173
162: ; preds = %148
%163 = load i32, i32* @stderr
%164 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %11, i64 0, i64 0
%165 = getelementptr inbounds [50 x i8], [50 x i8]* %164, i64 0, i64 0
%166 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %165)
%167 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%168 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %11, i64 0, i64 0
%169 = getelementptr inbounds [50 x i8], [50 x i8]* %168, i64 0, i64 0
%170 = call i32 (i8*, i8*, ...) @sprintf(i8* %167, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i8* %169)
%171 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%172 = call i32 @CSystem(i8* %171)
br label %198
173: ; preds = %148
store i32 1, i32* %6
br label %174
174: ; preds = %194, %173
%175 = load i32, i32* %6
%176 = load i32, i32* %8
%177 = icmp sle i32 %175, %176
br i1 %177, label %178, label %197
178: ; preds = %174
%179 = load i32, i32* @stderr
%180 = load i32, i32* %6
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %11, i64 0, i64 %181
%183 = getelementptr inbounds [50 x i8], [50 x i8]* %182, i64 0, i64 0
%184 = call i32 (i32, i8*, ...) @fprintf(i32 %179, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %183)
%185 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%186 = load i32, i32* %6
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %11, i64 0, i64 %187
%189 = getelementptr inbounds [50 x i8], [50 x i8]* %188, i64 0, i64 0
%190 = load i32, i32* %6
%191 = call i32 (i8*, i8*, ...) @sprintf(i8* %185, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0), i8* %189, i32 %190)
%192 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%193 = call i32 @CSystem(i8* %192)
br label %194
194: ; preds = %178
%195 = load i32, i32* %6
%196 = add nsw i32 %195, 1
store i32 %196, i32* %6
br label %174
197: ; preds = %174
br label %198
198: ; preds = %197, %162
%199 = load i32, i32* @stderr
%200 = getelementptr inbounds [50 x i8], [50 x i8]* %12, i64 0, i64 0
%201 = call i32 (i32, i8*, ...) @fprintf(i32 %199, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %200)
%202 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%203 = getelementptr inbounds [50 x i8], [50 x i8]* %12, i64 0, i64 0
%204 = call i32 (i8*, i8*, ...) @sprintf(i8* %202, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0), i8* %203)
%205 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%206 = call i32 @CSystem(i8* %205)
%207 = call i32 @CSystem(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0))
%208 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%209 = getelementptr inbounds [50 x i8], [50 x i8]* %13, i64 0, i64 0
%210 = call i32 (i8*, i8*, ...) @sprintf(i8* %208, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.16, i64 0, i64 0), i8* %209)
%211 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%212 = call i32 @CSystem(i8* %211)
%213 = call i32 @CSystem(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%214 = call i32 @CSystem(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0))
%215 = call i32 @CSystem(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
%216 = load i32, i32* %3
ret i32 %216
}

LLVM IR (-O2):
@.str = [4 x i8] c"cdb\00"
@.str.1 = [3 x i8] c".c\00"
@.str.2 = [5 x i8] c".pdm\00"
@.str.3 = [3 x i8] c"-f\00"
@.str.4 = [3 x i8] c"-o\00"
@.str.5 = [4 x i8] c"pdm\00"
@.str.6 = [2 x i8] c"c\00"
@stderr = global i32 0
@.str.7 = [28 x i8] c"CDB Compiler - Version 2.1\0A\00"
@.str.8 = [28 x i8] c"--------------------------\0A\00"
@.str.9 = [18 x i8] c"checking syntax.\0A\00"
@.str.10 = [26 x i8] c"echo %d > cdbc.pdm.number\00"
@.str.11 = [7 x i8] c" %s\0A\00"
@.str.12 = [35 x i8] c"./PDMParser < %s > cdbc.pdm.input0\00"
@.str.13 = [36 x i8] c"./PDMParser < %s > cdbc.pdm.input%d\00"
@.str.14 = [34 x i8] c"./CDBParser < %s > cdbc.cdb.input\00"
@.str.15 = [30 x i8] c"sbcl --noinform --load CDBRun\00"
@.str.16 = [29 x i8] c"indent cdbc.output -kr -o %s\00"
@.str.17 = [14 x i8] c"rm cdbc.pdm.*\00"
@.str.18 = [14 x i8] c"rm cdbc.cdb.*\00"
@.str.19 = [15 x i8] c"rm cdbc.output\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [50 x i8]
%4 = alloca [20 x [50 x i8]]
%5 = alloca [50 x i8]
%6 = alloca [50 x i8]
%7 = alloca [256 x i8]
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %4, i64 0, i64 0, i64 0
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%13 = icmp eq i32 %0, 1
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = tail call i32 (...) @Error()
br label %16
16: ; preds = %14, %2
%17 = add i32 %0, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i8* @FixExtension(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @strcpy(i8* %10, i8* %21)
%23 = call i32 @strlen(i8* %10)
%24 = icmp slt i32 %23, 5
br i1 %24, label %37, label %25
25: ; preds = %16, %25
%26 = phi i64 [ %30, %25 ], [ 0, %16 ]
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %26
store i8 %28, i8* %29
%30 = add nuw nsw i64 %26, 1
%31 = call i32 @strlen(i8* %10)
%32 = add nsw i32 %31, -5
%33 = sext i32 %32 to i64
%34 = icmp slt i64 %26, %33
br i1 %34, label %25, label %35
35: ; preds = %25
%36 = and i64 %30, 4294967295
br label %37
37: ; preds = %35, %16
%38 = phi i64 [ 0, %16 ], [ %36, %35 ]
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %38
store i8 0, i8* %39
%40 = call i32 @strcpy(i8* %11, i8* %8)
%41 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 @strcpy(i8* %9, i8* %8)
%43 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%44 = icmp slt i32 %0, 3
br i1 %44, label %95, label %45
45: ; preds = %37
%46 = add nsw i32 %0, -2
%47 = zext i32 %46 to i64
%48 = zext i32 %17 to i64
br label %49
49: ; preds = %45, %90
%50 = phi i64 [ 1, %45 ], [ %93, %90 ]
%51 = phi i32 [ 0, %45 ], [ %92, %90 ]
%52 = phi i32 [ 0, %45 ], [ %91, %90 ]
%53 = getelementptr inbounds i8*, i8** %1, i64 %50
%54 = load i8*, i8** %53
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %49
%58 = icmp eq i32 %51, 0
br i1 %58, label %90, label %59
59: ; preds = %57
%60 = call i32 (...) @Error()
br label %90
61: ; preds = %49
%62 = load i8*, i8** %53
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %70
65: ; preds = %61
%66 = add nuw nsw i64 %50, 1
%67 = icmp eq i64 %66, %47
br i1 %67, label %90, label %68
68: ; preds = %65
%69 = call i32 (...) @Error()
br label %90
70: ; preds = %61
%71 = load i8*, i8** %53
%72 = load i8, i8* %71
%73 = icmp eq i8 %72, 45
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = call i32 (...) @Error()
br label %76
76: ; preds = %74, %70
switch i32 %51, label %86 [
i32 0, label %77
i32 1, label %79
]
77: ; preds = %76
%78 = call i32 (...) @Error()
br label %86
79: ; preds = %76
%80 = add nsw i32 %52, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %4, i64 0, i64 %81, i64 0
%83 = load i8*, i8** %53
%84 = call i8* @FixExtension(i8* %83, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%85 = call i32 @strcpy(i8* %82, i8* %84)
br label %90
86: ; preds = %77, %76
%87 = load i8*, i8** %53
%88 = call i8* @FixExtension(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%89 = call i32 @strcpy(i8* %11, i8* %88)
br label %90
90: ; preds = %65, %68, %57, %59, %79, %86
%91 = phi i32 [ %80, %79 ], [ %52, %86 ], [ %52, %59 ], [ %52, %57 ], [ %52, %68 ], [ %52, %65 ]
%92 = phi i32 [ 1, %79 ], [ %51, %86 ], [ 1, %59 ], [ 1, %57 ], [ 2, %68 ], [ 2, %65 ]
%93 = add nuw nsw i64 %50, 1
%94 = icmp eq i64 %93, %48
br i1 %94, label %95, label %49
95: ; preds = %90, %37
%96 = phi i32 [ 0, %37 ], [ %91, %90 ]
%97 = load i32, i32* @stderr
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%99 = load i32, i32* @stderr
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%101 = load i32, i32* @stderr
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%103 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %96)
%104 = call i32 @CSystem(i8* %12)
%105 = icmp eq i32 %96, 0
br i1 %105, label %111, label %106
106: ; preds = %95
%107 = icmp slt i32 %96, 1
br i1 %107, label %126, label %108
108: ; preds = %106
%109 = add nuw i32 %96, 1
%110 = zext i32 %109 to i64
br label %116
111: ; preds = %95
%112 = load i32, i32* @stderr
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %9)
%114 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i8* %9)
%115 = call i32 @CSystem(i8* %12)
br label %126
116: ; preds = %108, %116
%117 = phi i64 [ 1, %108 ], [ %124, %116 ]
%118 = load i32, i32* @stderr
%119 = getelementptr inbounds [20 x [50 x i8]], [20 x [50 x i8]]* %4, i64 0, i64 %117, i64 0
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %119)
%121 = trunc i64 %117 to i32
%122 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0), i8* %119, i32 %121)
%123 = call i32 @CSystem(i8* %12)
%124 = add nuw nsw i64 %117, 1
%125 = icmp eq i64 %124, %110
br i1 %125, label %126, label %116
126: ; preds = %116, %106, %111
%127 = load i32, i32* @stderr
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %10)
%129 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0), i8* %10)
%130 = call i32 @CSystem(i8* %12)
%131 = call i32 @CSystem(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0))
%132 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.16, i64 0, i64 0), i8* %11)
%133 = call i32 @CSystem(i8* %12)
%134 = call i32 @CSystem(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%135 = call i32 @CSystem(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0))
%136 = call i32 @CSystem(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
ret i32 0
}