#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*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
char *ExpandSyntax(char *Format) {
  int i, Last;
  static char Parsed[80];
  Last = strlen(Format);
  sprintf(Parsed, "%s", "");
  for (i = 0; i < Last; i++) {
    switch (Format[i]) {
    case 'i':
      strcat(Parsed, "IntVar%");
      break;
    case 'I':
      strcat(Parsed, "Int%");
      break;
    case 'f':
      strcat(Parsed, "FloatVar");
      break;
    case 'F':
      strcat(Parsed, "Float");
      break;
    case 's':
      strcat(Parsed, "StringVar$");
      break;
    case 'S':
      strcat(Parsed, "String$");
      break;
    case '$':
      strcat(Parsed, "[OptionalPars ...]");
      break;
    case 'x':
      strcat(Parsed, "\"FileName\"");
      break;
    default:
      strcat(Parsed, "?Unknown?");
      break;
    }
    if ((Last > 1) && (i != (Last - 1)))
      strcat(Parsed, ", ");
  }
  return (Parsed);
}


x86 assembly (clang, -O0):
<ExpandSyntax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
lea    0x2f01(%rip),%rdi
lea    0xeaa(%rip),%rsi
lea    0xeff(%rip),%rdx
call   1050 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    131d <ExpandSyntax+0x1ed>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
sub    $0x24,%eax
je     1299 <ExpandSyntax+0x169>
jmp    1192 <ExpandSyntax+0x62>
mov    -0x14(%rbp),%eax
sub    $0x46,%eax
je     1251 <ExpandSyntax+0x121>
jmp    11a3 <ExpandSyntax+0x73>
mov    -0x14(%rbp),%eax
sub    $0x49,%eax
je     1221 <ExpandSyntax+0xf1>
jmp    11b4 <ExpandSyntax+0x84>
mov    -0x14(%rbp),%eax
sub    $0x53,%eax
je     1281 <ExpandSyntax+0x151>
jmp    11c5 <ExpandSyntax+0x95>
mov    -0x14(%rbp),%eax
sub    $0x66,%eax
je     1239 <ExpandSyntax+0x109>
jmp    11d6 <ExpandSyntax+0xa6>
mov    -0x14(%rbp),%eax
sub    $0x69,%eax
je     1209 <ExpandSyntax+0xd9>
jmp    11e7 <ExpandSyntax+0xb7>
mov    -0x14(%rbp),%eax
sub    $0x73,%eax
je     1269 <ExpandSyntax+0x139>
jmp    11f8 <ExpandSyntax+0xc8>
mov    -0x14(%rbp),%eax
sub    $0x78,%eax
je     12b1 <ExpandSyntax+0x181>
jmp    12c9 <ExpandSyntax+0x199>
lea    0x2e40(%rip),%rdi
lea    0xdec(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2e28(%rip),%rdi
lea    0xddc(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2e10(%rip),%rdi
lea    0xdc9(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2df8(%rip),%rdi
lea    0xdba(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2de0(%rip),%rdi
lea    0xda8(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2dc8(%rip),%rdi
lea    0xd9b(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2db0(%rip),%rdi
lea    0xd8b(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2d98(%rip),%rdi
lea    0xd86(%rip),%rsi
call   1040 <strcat@plt>
jmp    12dc <ExpandSyntax+0x1ac>
lea    0x2d80(%rip),%rdi
lea    0xd79(%rip),%rsi
call   1040 <strcat@plt>
cmpl   $0x1,-0x10(%rbp)
jle    130a <ExpandSyntax+0x1da>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     130a <ExpandSyntax+0x1da>
lea    0x2d52(%rip),%rdi
lea    0xd55(%rip),%rsi
call   1040 <strcat@plt>
jmp    130f <ExpandSyntax+0x1df>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <ExpandSyntax+0x39>
lea    0x2d2c(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExpandSyntax>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
movb   $0x0,0x2f06(%rip)
test   %eax,%eax
jle    120f <ExpandSyntax+0xef>
mov    %eax,%ebx
lea    -0x1(%rbx),%eax
mov    %rax,(%rsp)
mov    %ebx,%ebp
xor    %r12d,%r12d
lea    0x2ee9(%rip),%r15
lea    0xea2(%rip),%r13
jmp    116d <ExpandSyntax+0x4d>
add    $0x1,%r12
cmp    %r12,%rbp
je     120f <ExpandSyntax+0xef>
movsbl (%r14,%r12,1),%eax
lea    -0x46(%rax),%ecx
cmp    $0x32,%ecx
ja     1194 <ExpandSyntax+0x74>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
lea    0xf43(%rip),%rsi
jmp    *%rax
lea    0xf50(%rip),%rsi
jmp    11e0 <ExpandSyntax+0xc0>
cmp    $0x24,%eax
jne    11a2 <ExpandSyntax+0x82>
lea    0xf5b(%rip),%rsi
jmp    11e0 <ExpandSyntax+0xc0>
lea    0xf70(%rip),%rsi
jmp    11e0 <ExpandSyntax+0xc0>
lea    0xf22(%rip),%rsi
jmp    11e0 <ExpandSyntax+0xc0>
lea    0xf38(%rip),%rsi
jmp    11e0 <ExpandSyntax+0xc0>
lea    0xf15(%rip),%rsi
jmp    11e0 <ExpandSyntax+0xc0>
lea    0xf1b(%rip),%rsi
jmp    11e0 <ExpandSyntax+0xc0>
lea    0xf38(%rip),%rsi
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <strcat@plt>
cmp    $0x1,%ebx
je     1160 <ExpandSyntax+0x40>
cmp    %r12,(%rsp)
je     1160 <ExpandSyntax+0x40>
mov    %r15,%rdi
lea    0xf1e(%rip),%rsi
call   1040 <strcat@plt>
jmp    1160 <ExpandSyntax+0x40>
lea    0x2e2a(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@ExpandSyntax.Parsed = internal global [80 x i8] zeroinitializer
@.str = [3 x i8] c"%s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [8 x i8] c"IntVar%\00"
@.str.3 = [5 x i8] c"Int%\00"
@.str.4 = [9 x i8] c"FloatVar\00"
@.str.5 = [6 x i8] c"Float\00"
@.str.6 = [11 x i8] c"StringVar$\00"
@.str.7 = [8 x i8] c"String$\00"
@.str.8 = [19 x i8] c"[OptionalPars ...]\00"
@.str.9 = [11 x i8] c"\22FileName\22\00"
@.str.10 = [10 x i8] c"?Unknown?\00"
@.str.11 = [3 x i8] c", \00"
define i8* @ExpandSyntax(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = call i32 @sprintf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %48, %1
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %51
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
switch i32 %18, label %35 [
i32 105, label %19
i32 73, label %21
i32 102, label %23
i32 70, label %25
i32 115, label %27
i32 83, label %29
i32 36, label %31
i32 120, label %33
]
19: ; preds = %12
%20 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %37
21: ; preds = %12
%22 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %37
23: ; preds = %12
%24 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %37
25: ; preds = %12
%26 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %37
27: ; preds = %12
%28 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %37
29: ; preds = %12
%30 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %37
31: ; preds = %12
%32 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %37
33: ; preds = %12
%34 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
br label %37
35: ; preds = %12
%36 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
br label %37
37: ; preds = %35, %33, %31, %29, %27, %25, %23, %21, %19
%38 = load i32, i32* %4
%39 = icmp sgt i32 %38, 1
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = sub nsw i32 %42, 1
%44 = icmp ne i32 %41, %43
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %47
47: ; preds = %45, %40, %37
br label %48
48: ; preds = %47
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %8
51: ; preds = %8
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0)
}

LLVM IR (-O2):
@ExpandSyntax.Parsed = internal global [80 x i8] zeroinitializer
@.str.2 = [8 x i8] c"IntVar%\00"
@.str.3 = [5 x i8] c"Int%\00"
@.str.4 = [9 x i8] c"FloatVar\00"
@.str.5 = [6 x i8] c"Float\00"
@.str.6 = [11 x i8] c"StringVar$\00"
@.str.7 = [8 x i8] c"String$\00"
@.str.8 = [19 x i8] c"[OptionalPars ...]\00"
@.str.9 = [11 x i8] c"\22FileName\22\00"
@.str.10 = [10 x i8] c"?Unknown?\00"
@.str.11 = [3 x i8] c", \00"
define i8* @ExpandSyntax(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
store i8 0, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %32
4: ; preds = %1
%5 = icmp eq i32 %2, 1
%6 = add nsw i32 %2, -1
%7 = zext i32 %6 to i64
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %4, %29
%10 = phi i64 [ 0, %4 ], [ %30, %29 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
switch i32 %13, label %21 [
i32 105, label %22
i32 73, label %14
i32 102, label %15
i32 70, label %16
i32 115, label %17
i32 83, label %18
i32 36, label %19
i32 120, label %20
]
14: ; preds = %9
br label %22
15: ; preds = %9
br label %22
16: ; preds = %9
br label %22
17: ; preds = %9
br label %22
18: ; preds = %9
br label %22
19: ; preds = %9
br label %22
20: ; preds = %9
br label %22
21: ; preds = %9
br label %22
22: ; preds = %9, %21, %20, %19, %18, %17, %16, %15, %14
%23 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), %21 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), %20 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), %19 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %18 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), %17 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %16 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), %15 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %14 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %9 ]
%24 = tail call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* %23)
%25 = icmp eq i64 %10, %7
%26 = select i1 %5, i1 true, i1 %25
br i1 %26, label %29, label %27
27: ; preds = %22
%28 = tail call i32 @strcat(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %29
29: ; preds = %22, %27
%30 = add nuw nsw i64 %10, 1
%31 = icmp eq i64 %30, %8
br i1 %31, label %32, label %9
32: ; preds = %29, %1
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @ExpandSyntax.Parsed, i64 0, i64 0)
}