#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*/ MCParse(int);
int /*<<< orphan*/ MCWriteCat(int);
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ err(int, char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
int open(char *, int, ...);
scalar_t__ optind;
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int ofd, ifd;
  char *catfile = NULL;
  int c;
  while ((c = getopt(argc, argv, "new")) != -1) {
    switch (c) {
    case 'n':
      fprintf(stderr, "WARNING: Usage of \"-new\" argument is deprecated.\n");
    case 'e':
    case 'w':
      break;
    case '?':
    default:
      usage();
    }
  }
  argc -= optind;
  argv += optind;
  if (argc < 2) {
    usage();
  }
  catfile = *argv++;
  for (; *argv; argv++) {
    if ((ifd = open(*argv, O_RDONLY)) < 0)
      err(1, "Unable to read %s", *argv);
    MCParse(ifd);
    close(ifd);
  }
  if ((ofd = open(catfile, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0)
    err(1, "Unable to create a new %s", catfile);
  MCWriteCat(ofd);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe44(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     123f <main+0xaf>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x3f,%eax
je     122e <main+0x9e>
jmp    11e1 <main+0x51>
mov    -0x28(%rbp),%eax
sub    $0x65,%eax
je     1229 <main+0x99>
jmp    11f2 <main+0x62>
mov    -0x28(%rbp),%eax
sub    $0x6e,%eax
je     1214 <main+0x84>
jmp    1203 <main+0x73>
mov    -0x28(%rbp),%eax
sub    $0x77,%eax
je     1229 <main+0x99>
jmp    1233 <main+0xa3>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
lea    0xde0(%rip),%rsi
call   1040 <fprintf@plt>
jmp    123a <main+0xaa>
jmp    1233 <main+0xa3>
mov    $0x0,%al
call   1070 <usage@plt>
jmp    11ae <main+0x1e>
mov    0x2d8a(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2d76(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    127a <main+0xea>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     12fa <main+0x16a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2d2c(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    12d9 <main+0x149>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    $0x1,%edi
lea    0xd62(%rip),%rsi
call   1060 <err@plt>
mov    -0x18(%rbp),%edi
call   10b0 <MCParse@plt>
mov    -0x18(%rbp),%edi
call   1030 <close@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1290 <main+0x100>
mov    -0x20(%rbp),%rdi
mov    0x2cab(%rip),%rax
mov    (%rax),%esi
mov    0x2ce2(%rip),%rax
or     (%rax),%esi
mov    0x2ce1(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1346 <main+0x1b6>
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
lea    0xd07(%rip),%rsi
call   1060 <err@plt>
mov    -0x14(%rbp),%edi
call   1050 <MCWriteCat@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe5c(%rip),%r14
mov    0x2e15(%rip),%r12
lea    0xe52(%rip),%r15
jmp    11c0 <main+0x30>
cmp    $0xffffffff,%eax
je     11f7 <main+0x67>
xor    %eax,%eax
call   1070 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <getopt@plt>
cmp    $0x6d,%eax
jle    11f0 <main+0x60>
cmp    $0x77,%eax
je     11c0 <main+0x30>
cmp    $0x6e,%eax
jne    11b9 <main+0x29>
mov    (%r12),%edi
mov    %r15,%rsi
call   1040 <fprintf@plt>
jmp    11c0 <main+0x30>
nopw   0x0(%rax,%rax,1)
cmp    $0x65,%eax
je     11c0 <main+0x30>
jmp    11b4 <main+0x24>
mov    0x2dd2(%rip),%rax
mov    (%rax),%r15
sub    %r15d,%ebp
cmp    $0x1,%ebp
jg     1210 <main+0x80>
xor    %eax,%eax
call   1070 <usage@plt>
mov    (%rbx,%r15,8),%r14
mov    0x8(%rbx,%r15,8),%rdi
test   %rdi,%rdi
jne    1270 <main+0xe0>
mov    0x2d8b(%rip),%rax
mov    0x2dc4(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dc1(%rip),%rax
or     (%rax),%esi
mov    %r14,%rdi
mov    $0x1b6,%edx
xor    %eax,%eax
call   1080 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1262 <main+0xd2>
lea    0xdf3(%rip),%rsi
mov    $0x1,%edi
mov    %r14,%rdx
call   1060 <err@plt>
mov    %ebx,%edi
call   1050 <MCWriteCat@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    (%rbx,%r15,8),%rbx
add    $0x10,%rbx
mov    0x2d59(%rip),%r12
lea    0xdb0(%rip),%r15
jmp    12ae <main+0x11e>
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   10b0 <MCParse@plt>
mov    %ebp,%edi
call   1030 <close@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     121e <main+0x8e>
mov    (%r12),%esi
xor    %eax,%eax
call   1080 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1290 <main+0x100>
mov    -0x8(%rbx),%rdx
mov    $0x1,%edi
mov    %r15,%rsi
call   1060 <err@plt>
jmp    1290 <main+0x100>

LLVM IR (-O0):
@.str = [4 x i8] c"new\00"
@stderr = global i32 0
@.str.1 = [50 x i8] c"WARNING: Usage of \22-new\22 argument is deprecated.\0A\00"
@optind = global i64 0
@O_RDONLY = global i32 0
@.str.2 = [18 x i8] c"Unable to read %s\00"
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@.str.3 = [26 x i8] c"Unable to create a new %s\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 i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %8
br label %10
10: ; preds = %24, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %9
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %25
15: ; preds = %10
%16 = load i32, i32* %9
switch i32 %16, label %22 [
i32 110, label %17
i32 101, label %20
i32 119, label %20
i32 63, label %21
]
17: ; preds = %15
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %15, %15, %17
br label %24
21: ; preds = %15
br label %22
22: ; preds = %15, %21
%23 = call i32 (...) @usage()
br label %24
24: ; preds = %22, %20
br label %10
25: ; preds = %10
%26 = load i64, i64* @optind
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = sub nsw i64 %28, %26
%30 = trunc i64 %29 to i32
store i32 %30, i32* %4
%31 = load i64, i64* @optind
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 %31
store i8** %33, i8*** %5
%34 = load i32, i32* %4
%35 = icmp slt i32 %34, 2
br i1 %35, label %36, label %38
36: ; preds = %25
%37 = call i32 (...) @usage()
br label %38
38: ; preds = %36, %25
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i32 1
store i8** %40, i8*** %5
%41 = load i8*, i8** %39
store i8* %41, i8** %8
br label %42
42: ; preds = %61, %38
%43 = load i8**, i8*** %5
%44 = load i8*, i8** %43
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %64
46: ; preds = %42
%47 = load i8**, i8*** %5
%48 = load i8*, i8** %47
%49 = load i32, i32* @O_RDONLY
%50 = call i32 (i8*, i32, ...) @open(i8* %48, i32 %49)
store i32 %50, i32* %7
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %56
52: ; preds = %46
%53 = load i8**, i8*** %5
%54 = load i8*, i8** %53
%55 = call i32 @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %52, %46
%57 = load i32, i32* %7
%58 = call i32 @MCParse(i32 %57)
%59 = load i32, i32* %7
%60 = call i32 @close(i32 %59)
br label %61
61: ; preds = %56
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i32 1
store i8** %63, i8*** %5
br label %42
64: ; preds = %42
%65 = load i8*, i8** %8
%66 = load i32, i32* @O_WRONLY
%67 = load i32, i32* @O_TRUNC
%68 = or i32 %66, %67
%69 = load i32, i32* @O_CREAT
%70 = or i32 %68, %69
%71 = call i32 (i8*, i32, ...) @open(i8* %65, i32 %70, i32 438)
store i32 %71, i32* %6
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %64
%74 = load i8*, i8** %8
%75 = call i32 @err(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %74)
br label %76
76: ; preds = %73, %64
%77 = load i32, i32* %6
%78 = call i32 @MCWriteCat(i32 %77)
%79 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"new\00"
@stderr = global i32 0
@.str.1 = [50 x i8] c"WARNING: Usage of \22-new\22 argument is deprecated.\0A\00"
@optind = global i64 0
@O_RDONLY = global i32 0
@.str.2 = [18 x i8] c"Unable to read %s\00"
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@.str.3 = [26 x i8] c"Unable to create a new %s\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %9 [
i32 -1, label %11
i32 110, label %6
i32 101, label %5
i32 119, label %5
]
5: ; preds = %3, %3, %6, %9
br label %3
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %5
9: ; preds = %3
%10 = tail call i32 (...) @usage()
br label %5
11: ; preds = %3
%12 = load i64, i64* @optind
%13 = trunc i64 %12 to i32
%14 = sub i32 %0, %13
%15 = getelementptr inbounds i8*, i8** %1, i64 %12
%16 = icmp slt i32 %14, 2
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = tail call i32 (...) @usage()
br label %19
19: ; preds = %17, %11
%20 = load i8*, i8** %15
%21 = getelementptr inbounds i8*, i8** %15, i64 1
%22 = load i8*, i8** %21
%23 = icmp eq i8* %22, null
br i1 %23, label %39, label %24
24: ; preds = %19, %33
%25 = phi i8* [ %37, %33 ], [ %22, %19 ]
%26 = phi i8** [ %36, %33 ], [ %21, %19 ]
%27 = load i32, i32* @O_RDONLY
%28 = tail call i32 (i8*, i32, ...) @open(i8* %25, i32 %27)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i8*, i8** %26
%32 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %30, %24
%34 = tail call i32 @MCParse(i32 %28)
%35 = tail call i32 @close(i32 %28)
%36 = getelementptr inbounds i8*, i8** %26, i64 1
%37 = load i8*, i8** %36
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %24
39: ; preds = %33, %19
%40 = load i32, i32* @O_WRONLY
%41 = load i32, i32* @O_TRUNC
%42 = or i32 %41, %40
%43 = load i32, i32* @O_CREAT
%44 = or i32 %42, %43
%45 = tail call i32 (i8*, i32, ...) @open(i8* %20, i32 %44, i32 438)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %49
49: ; preds = %47, %39
%50 = tail call i32 @MCWriteCat(i32 %45)
%51 = tail call i32 @exit(i32 0)
unreachable
}