#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 */
char *flags(char *);
char *gets(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ skip(char *);
int main() {
  char name[24];
  char *p, *q;
  int symbol;
  printf("del ..\\test.zo3\\*.*\n");
  printf("del ..\\text.zo3\\*.*\n");
  printf("..\\masmx a1 ..\\test.zo3\\a2 -z > ..\\text.zo3\\a2.txo\n");
  printf("..\\masmx a1 ..\\test.zo3\\a3 -c > ..\\text.zo3\\a3.txo\n");
  printf("..\\masmx a1 ..\\test.zo3\\a4 -zc > ..\\text.zo3\\a4.txo\n");
  for (;;) {
    p = gets(name);
    if (!p)
      break;
    while (symbol = *p) {
      if (symbol == '.')
        break;
      p++;
    }
    *p = 0;
    if (skip(name))
      continue;
    q = flags(name);
    printf("..\\masmz %s %s ..\\test.zo3\\%s > ..\\text.zo3\\%s.txt\n", name, q,
           name, name);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <gets@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11b2 <main+0x72>
jmp    1239 <main+0xf9>
jmp    11b7 <main+0x77>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
je     11ea <main+0xaa>
cmpl   $0x2e,-0x34(%rbp)
jne    11d9 <main+0x99>
jmp    11ea <main+0xaa>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11b7 <main+0x77>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x20(%rbp),%rdi
call   1030 <skip@plt>
cmp    $0x0,%rax
je     1209 <main+0xc9>
jmp    1195 <main+0x55>
lea    -0x20(%rbp),%rdi
call   1060 <flags@plt>
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x20(%rbp),%r8
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1195 <main+0x55>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xede(%rip),%rdi
call   1040 <puts@plt>
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1040 <puts@plt>
lea    0xf34(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     1200 <main+0xb0>
mov    %rsp,%rbx
lea    0xe56(%rip),%r14
jmp    11cd <main+0x7d>
nopl   0x0(%rax)
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1030 <skip@plt>
test   %rax,%rax
je     11e0 <main+0x90>
mov    %rbx,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     1200 <main+0xb0>
movzbl (%rax),%ecx
test   %cl,%cl
je     11b0 <main+0x60>
cmp    $0x2e,%cl
je     11b0 <main+0x60>
add    $0x1,%rax
jmp    11cd <main+0x7d>
nop
mov    %rbx,%rdi
call   1070 <flags@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11c0 <main+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"del ..\\test.zo3\\*.*\0A\00"
@.str.1 = [21 x i8] c"del ..\\text.zo3\\*.*\0A\00"
@.str.2 = [52 x i8] c"..\\masmx a1 ..\\test.zo3\\a2 -z > ..\\text.zo3\\a2.txo\0A\00"
@.str.3 = [52 x i8] c"..\\masmx a1 ..\\test.zo3\\a3 -c > ..\\text.zo3\\a3.txo\0A\00"
@.str.4 = [53 x i8] c"..\\masmx a1 ..\\test.zo3\\a4 -zc > ..\\text.zo3\\a4.txo\0A\00"
@.str.5 = [52 x i8] c"..\\masmz %s %s ..\\test.zo3\\%s > ..\\text.zo3\\%s.txt\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [24 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
br label %11
11: ; preds = %36, %35, %0
%12 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%13 = call i8* @gets(i8* %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = icmp ne i8* %14, null
br i1 %15, label %17, label %16
16: ; preds = %11
br label %44
17: ; preds = %11
br label %18
18: ; preds = %27, %17
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
store i32 %21, i32* %5
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %18
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 46
br i1 %25, label %26, label %27
26: ; preds = %23
br label %30
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %3
br label %18
30: ; preds = %26, %18
%31 = load i8*, i8** %3
store i8 0, i8* %31
%32 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%33 = call i64 @skip(i8* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %30
br label %11
36: ; preds = %30
%37 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%38 = call i8* @flags(i8* %37)
store i8* %38, i8** %4
%39 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%40 = load i8*, i8** %4
%41 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%42 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* %39, i8* %40, i8* %41, i8* %42)
br label %11
44: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [52 x i8] c"..\\masmz %s %s ..\\test.zo3\\%s > ..\\text.zo3\\%s.txt\0A\00"
@str = [20 x i8] c"del ..\\test.zo3\\*.*\00"
@str.6 = [20 x i8] c"del ..\\text.zo3\\*.*\00"
@str.7 = [51 x i8] c"..\\masmx a1 ..\\test.zo3\\a2 -z > ..\\text.zo3\\a2.txo\00"
@str.8 = [51 x i8] c"..\\masmx a1 ..\\test.zo3\\a3 -c > ..\\text.zo3\\a3.txo\00"
@str.9 = [52 x i8] c"..\\masmx a1 ..\\test.zo3\\a4 -zc > ..\\text.zo3\\a4.txo\00"
define i32 @main() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.7, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.8, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.9, i64 0, i64 0))
%8 = call i8* @gets(i8* %2)
%9 = icmp eq i8* %8, null
br i1 %9, label %26, label %10
10: ; preds = %0, %15
%11 = phi i8* [ %16, %15 ], [ %8, %0 ]
%12 = load i8, i8* %11
switch i8 %12, label %13 [
i8 46, label %17
i8 0, label %17
]
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %11, i64 1
br label %15
15: ; preds = %13, %23
%16 = phi i8* [ %14, %13 ], [ %24, %23 ]
br label %10
17: ; preds = %10, %10
store i8 0, i8* %11
%18 = call i64 @skip(i8* %2)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = call i8* @flags(i8* %2)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* %21, i8* %2, i8* %2)
br label %23
23: ; preds = %20, %17
%24 = call i8* @gets(i8* %2)
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %15
26: ; preds = %23, %0
ret i32 0
}