#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();
int /*<<< orphan*/ FixExtension(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int strlen(char *);
int main(int argc, char *argv[]) {
  int Counter;
  char PDMFileName[50], OutputFileName[50], DummyString[50], Command[256];
  if (argc != 2)
    Error();
  strcpy(PDMFileName, FixExtension(argv[argc - 1], "pdm"));
  for (Counter = 0; Counter <= (strlen(PDMFileName) - 5); Counter++)
    OutputFileName[Counter] = PDMFileName[Counter];
  OutputFileName[Counter] = '\0';
  strcat(OutputFileName, ".h");
  fprintf(stderr, "PDM Compiler - Version 2.1\n");
  fprintf(stderr, "--------------------------\n");
  fprintf(stderr, "checking syntax.\n");
  fprintf(stderr, "   %s\n", PDMFileName);
  sprintf(Command, "./PDMParser < %s > pdmc.pdm.input", PDMFileName);
  CSystem(Command);
  CSystem("sbcl --noinform --load PDMRun");
  sprintf(Command, "indent pdmc.h.output -kr -o %s", OutputFileName);
  CSystem(Command);
  OutputFileName[Counter + 1] = 'c';
  sprintf(Command, "indent pdmc.c.output -kr -o %s", OutputFileName);
  CSystem(Command);
  CSystem("rm pdmc.*");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11aa <main+0x2a>
mov    $0x0,%al
call   1060 <Error@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x1d8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe33(%rip),%rsi
call   10a0 <FixExtension@plt>
mov    -0x1d8(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1dc(%rbp)
lea    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x1dc(%rbp),%eax
sub    $0x5,%ecx
cmp    %ecx,%eax
jg     122d <main+0xad>
movslq -0x14(%rbp),%rax
mov    -0x50(%rbp,%rax,1),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e7 <main+0x67>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x90(%rbp,%rax,1)
lea    -0x90(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   1080 <strcat@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d76(%rip),%rax
mov    (%rax),%edi
lea    0xdb0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
lea    -0x50(%rbp),%rdx
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    -0x1d0(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xd9a(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
call   1040 <CSystem@plt>
lea    0xda4(%rip),%rdi
call   1040 <CSystem@plt>
lea    -0x1d0(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xda8(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
call   1040 <CSystem@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x63,-0x90(%rbp,%rax,1)
63
lea    -0x1d0(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xd91(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x1d0(%rbp),%rdi
call   1040 <CSystem@plt>
lea    0xd98(%rip),%rdi
call   1040 <CSystem@plt>
mov    -0x4(%rbp),%eax
add    $0x1e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x188,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x2,%edi
je     119e <main+0x1e>
xor    %eax,%eax
call   1060 <Error@plt>
movslq %ebp,%rax
mov    -0x8(%rbx,%rax,8),%rdi
lea    0xe53(%rip),%rsi
call   10a0 <FixExtension@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
xor    %ebx,%ebx
cmp    $0x5,%eax
jl     1201 <main+0x81>
xor    %ebx,%ebx
lea    0x40(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rbp
movzbl 0x40(%rsp,%rbx,1),%eax
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
add    $0xfffffffb,%eax
cltq
cmp    %rax,%rbp
jl     11e0 <main+0x60>
mov    %ebx,%r15d
movb   $0x0,(%rsp,%r15,1)
lea    0xdf4(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1080 <strcat@plt>
mov    0x2dbe(%rip),%rbx
mov    (%rbx),%edi
lea    0xddc(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%edi
lea    0xde8(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdf4(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdf6(%rip),%rsi
lea    0x40(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xde7(%rip),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <CSystem@plt>
lea    0xde7(%rip),%rdi
call   1040 <CSystem@plt>
lea    0xdf9(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <CSystem@plt>
movb   $0x63,0x1(%rsp,%r15,1)
lea    0xdf8(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <CSystem@plt>
lea    0xdfd(%rip),%rdi
call   1040 <CSystem@plt>
xor    %eax,%eax
add    $0x188,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"pdm\00"
@.str.1 = [3 x i8] c".h\00"
@stderr = global i32 0
@.str.2 = [28 x i8] c"PDM Compiler - Version 2.1\0A\00"
@.str.3 = [28 x i8] c"--------------------------\0A\00"
@.str.4 = [18 x i8] c"checking syntax.\0A\00"
@.str.5 = [7 x i8] c" %s\0A\00"
@.str.6 = [34 x i8] c"./PDMParser < %s > pdmc.pdm.input\00"
@.str.7 = [30 x i8] c"sbcl --noinform --load PDMRun\00"
@.str.8 = [31 x i8] c"indent pdmc.h.output -kr -o %s\00"
@.str.9 = [31 x i8] c"indent pdmc.c.output -kr -o %s\00"
@.str.10 = [10 x i8] c"rm pdmc.*\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [50 x i8]
%8 = alloca [50 x i8]
%9 = alloca [50 x i8]
%10 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (...) @Error()
br label %15
15: ; preds = %13, %2
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%17 = load i8**, i8*** %5
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %17, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @FixExtension(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @strcpy(i8* %16, i32 %23)
store i32 0, i32* %6
br label %25
25: ; preds = %39, %15
%26 = load i32, i32* %6
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = sub nsw i32 %28, 5
%30 = icmp sle i32 %26, %29
br i1 %30, label %31, label %42
31: ; preds = %25
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 %37
store i8 %35, i8* %38
br label %39
39: ; preds = %31
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %25
42: ; preds = %25
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 %44
store i8 0, i8* %45
%46 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%47 = call i32 @strcat(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32, i32* @stderr
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%54 = load i32, i32* @stderr
%55 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %55)
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%58 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%59 = call i32 @sprintf(i8* %57, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %58)
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%61 = call i32 @CSystem(i8* %60)
%62 = call i32 @CSystem(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%64 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%65 = call i32 @sprintf(i8* %63, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %64)
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%67 = call i32 @CSystem(i8* %66)
%68 = load i32, i32* %6
%69 = add nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 %70
store i8 99, i8* %71
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%73 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%74 = call i32 @sprintf(i8* %72, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %73)
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%76 = call i32 @CSystem(i8* %75)
%77 = call i32 @CSystem(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%78 = load i32, i32* %3
ret i32 %78
}

LLVM IR (-O2):
@.str = [4 x i8] c"pdm\00"
@.str.1 = [3 x i8] c".h\00"
@stderr = global i32 0
@.str.2 = [28 x i8] c"PDM Compiler - Version 2.1\0A\00"
@.str.3 = [28 x i8] c"--------------------------\0A\00"
@.str.4 = [18 x i8] c"checking syntax.\0A\00"
@.str.5 = [7 x i8] c" %s\0A\00"
@.str.6 = [34 x i8] c"./PDMParser < %s > pdmc.pdm.input\00"
@.str.7 = [30 x i8] c"sbcl --noinform --load PDMRun\00"
@.str.8 = [31 x i8] c"indent pdmc.h.output -kr -o %s\00"
@.str.9 = [31 x i8] c"indent pdmc.c.output -kr -o %s\00"
@.str.10 = [10 x i8] c"rm pdmc.*\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 2
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 (...) @Error()
br label %12
12: ; preds = %10, %2
%13 = add nsw i32 %0, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 @FixExtension(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @strcpy(i8* %6, i32 %17)
%19 = call i32 @strlen(i8* %6)
%20 = icmp slt i32 %19, 5
br i1 %20, label %33, label %21
21: ; preds = %12, %21
%22 = phi i64 [ %26, %21 ], [ 0, %12 ]
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %22
store i8 %24, i8* %25
%26 = add nuw nsw i64 %22, 1
%27 = call i32 @strlen(i8* %6)
%28 = add nsw i32 %27, -5
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %22, %29
br i1 %30, label %21, label %31
31: ; preds = %21
%32 = trunc i64 %26 to i32
br label %33
33: ; preds = %31, %12
%34 = phi i32 [ 0, %12 ], [ %32, %31 ]
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %35
store i8 0, i8* %36
%37 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%46 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %6)
%47 = call i32 @CSystem(i8* %8)
%48 = call i32 @CSystem(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%49 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %7)
%50 = call i32 @CSystem(i8* %8)
%51 = add nuw nsw i32 %34, 1
%52 = zext i32 %51 to i64
%53 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %52
store i8 99, i8* %53
%54 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %7)
%55 = call i32 @CSystem(i8* %8)
%56 = call i32 @CSystem(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}