#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ addcr(unsigned char *, unsigned char **);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(unsigned char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
unsigned char *malloc(int);
int /*<<< orphan*/ stderr;
const int main(const int argc, char **argv) {
  FILE *fp;
  unsigned char *list0 = malloc((64 * 1024)), *list1;
  unsigned char *p0 = malloc((32 * 1024 * 1024)), *name, *lname;
  unsigned int i;
  if (argc < 2)
    goto error;
  if (p0 == NULL)
    goto error;
  for (i = 1; i < argc; i++) {
    name = argv[i];
    if (*name != '@') {
      if (addcr(p0, &name))
        goto error;
    } else {
      fp = fopen(lname = name + 1, "rb");
      list1 = list0 + fread(list0, 1, (64 * 1024), fp);
      fclose(fp);
      if (list1 - list0 >= (64 * 1024) - 1)
        goto error1;
      *list1 = '\0';
      name = list0;
      for (;;) {
        while (name < list1 && *name <= ' ')
          name++;
        if (name >= list1)
          break;
        if (addcr(p0, &name))
          goto error;
      }
    }
  }
  return 0;
error1:
  fprintf(stderr, "addcr:error -- \"%s\".\n", lname);
error:
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x2000000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a1 <main+0x41>
jmp    133d <main+0x1dd>
cmpq   $0x0,-0x30(%rbp)
jne    11b1 <main+0x51>
jmp    133d <main+0x1dd>
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1318 <main+0x1b8>
mov    -0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x40,%eax
je     1204 <main+0xa4>
mov    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <addcr@plt>
cmp    $0x0,%rax
je     11ff <main+0x9f>
jmp    133d <main+0x1dd>
jmp    1305 <main+0x1a5>
mov    -0x38(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x40(%rbp)
lea    0xde9(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10000,%edx
call   1030 <fread@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
cmp    $0xffff,%rax
jl     1274 <main+0x114>
jmp    1324 <main+0x1c4>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1288 <main+0x128>
mov    -0x38(%rbp),%rcx
xor    %eax,%eax
cmp    -0x28(%rbp),%rcx
mov    %al,-0x51(%rbp)
jae    12ab <main+0x14b>
mov    -0x38(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
setle  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    12bb <main+0x15b>
jmp    12cc <main+0x16c>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1288 <main+0x128>
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jb     12df <main+0x17f>
jmp    1300 <main+0x1a0>
mov    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <addcr@plt>
cmp    $0x0,%rax
je     12fb <main+0x19b>
jmp    133d <main+0x1dd>
jmp    1283 <main+0x123>
jmp    1305 <main+0x1a5>
jmp    130a <main+0x1aa>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11b8 <main+0x58>
movl   $0x0,-0x4(%rbp)
jmp    1344 <main+0x1e4>
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    0xccb(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x10000,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    $0x2000000,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0x1,%eax
cmp    $0x2,%ebp
jl     12b5 <main+0x155>
test   %rbx,%rbx
je     12b5 <main+0x155>
mov    %ebp,%r13d
mov    $0x1,%r15d
mov    %rbx,0x10(%rsp)
mov    %r13,0x8(%rsp)
jmp    11e1 <main+0x81>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1070 <addcr@plt>
test   %rax,%rax
jne    12b0 <main+0x150>
add    $0x1,%r15
cmp    %r13,%r15
je     1294 <main+0x134>
mov    (%r14,%r15,8),%rbp
mov    %rbp,(%rsp)
cmpb   $0x40,0x0(%rbp)
jne    11c0 <main+0x60>
mov    %r14,%r13
add    $0x1,%rbp
mov    %rbp,%rdi
lea    0xe00(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x10000,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
mov    %r12,%rbx
mov    %eax,%r12d
mov    %r14,%rdi
call   1040 <fclose@plt>
cmp    $0xfffe,%r12d
jg     1298 <main+0x138>
movslq %r12d,%rbp
add    %rbx,%rbp
movb   $0x0,0x0(%rbp)
mov    %rbx,(%rsp)
test   %r12d,%r12d
mov    %r13,%r14
mov    %rbx,%r12
mov    0x10(%rsp),%rbx
mov    0x8(%rsp),%r13
jle    11d4 <main+0x74>
mov    %r12,%rax
jmp    1271 <main+0x111>
add    $0x1,%rax
mov    %rax,(%rsp)
cmp    %rbp,%rax
jae    11d4 <main+0x74>
cmpb   $0x20,(%rax)
jbe    1260 <main+0x100>
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1070 <addcr@plt>
test   %rax,%rax
jne    12b0 <main+0x150>
mov    (%rsp),%rax
cmp    %rbp,%rax
jb     1271 <main+0x111>
jmp    11d4 <main+0x74>
xor    %eax,%eax
jmp    12b5 <main+0x155>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
lea    0xd5b(%rip),%rsi
mov    %rbp,%rdx
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"addcr:error -- \22%s\22.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i8* @malloc(i32 65536)
store i8* %13, i8** %7
%14 = call i8* @malloc(i32 33554432)
store i8* %14, i8** %9
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %2
br label %101
18: ; preds = %2
%19 = load i8*, i8** %9
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %22
21: ; preds = %18
br label %101
22: ; preds = %18
store i32 1, i32* %12
br label %23
23: ; preds = %93, %22
%24 = load i32, i32* %12
%25 = load i32, i32* %4
%26 = icmp ult i32 %24, %25
br i1 %26, label %27, label %96
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = load i32, i32* %12
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
store i8* %32, i8** %10
%33 = load i8*, i8** %10
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = icmp ne i32 %35, 64
br i1 %36, label %37, label %43
37: ; preds = %27
%38 = load i8*, i8** %9
%39 = call i64 @addcr(i8* %38, i8** %10)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %37
br label %101
42: ; preds = %37
br label %92
43: ; preds = %27
%44 = load i8*, i8** %10
%45 = getelementptr inbounds i8, i8* %44, i64 1
store i8* %45, i8** %11
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %46, i32** %6
%47 = load i8*, i8** %7
%48 = load i8*, i8** %7
%49 = load i32*, i32** %6
%50 = call i32 @fread(i8* %48, i32 1, i32 65536, i32* %49)
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %47, i64 %51
store i8* %52, i8** %8
%53 = load i32*, i32** %6
%54 = call i32 @fclose(i32* %53)
%55 = load i8*, i8** %8
%56 = load i8*, i8** %7
%57 = ptrtoint i8* %55 to i64
%58 = ptrtoint i8* %56 to i64
%59 = sub i64 %57, %58
%60 = icmp sge i64 %59, 65535
br i1 %60, label %61, label %62
61: ; preds = %43
br label %97
62: ; preds = %43
%63 = load i8*, i8** %8
store i8 0, i8* %63
%64 = load i8*, i8** %7
store i8* %64, i8** %10
br label %65
65: ; preds = %90, %62
br label %66
66: ; preds = %77, %65
%67 = load i8*, i8** %10
%68 = load i8*, i8** %8
%69 = icmp ult i8* %67, %68
br i1 %69, label %70, label %75
70: ; preds = %66
%71 = load i8*, i8** %10
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = icmp sle i32 %73, 32
br label %75
75: ; preds = %70, %66
%76 = phi i1 [ false, %66 ], [ %74, %70 ]
br i1 %76, label %77, label %80
77: ; preds = %75
%78 = load i8*, i8** %10
%79 = getelementptr inbounds i8, i8* %78, i32 1
store i8* %79, i8** %10
br label %66
80: ; preds = %75
%81 = load i8*, i8** %10
%82 = load i8*, i8** %8
%83 = icmp uge i8* %81, %82
br i1 %83, label %84, label %85
84: ; preds = %80
br label %91
85: ; preds = %80
%86 = load i8*, i8** %9
%87 = call i64 @addcr(i8* %86, i8** %10)
%88 = icmp ne i64 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %85
br label %101
90: ; preds = %85
br label %65
91: ; preds = %84
br label %92
92: ; preds = %91, %42
br label %93
93: ; preds = %92
%94 = load i32, i32* %12
%95 = add i32 %94, 1
store i32 %95, i32* %12
br label %23
96: ; preds = %23
store i32 0, i32* %3
br label %102
97: ; preds = %61
%98 = load i32, i32* @stderr
%99 = load i8*, i8** %11
%100 = call i32 @fprintf(i32 %98, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %99)
br label %101
101: ; preds = %97, %89, %41, %21, %17
store i32 1, i32* %3
br label %102
102: ; preds = %101, %96
%103 = load i32, i32* %3
ret i32 %103
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"addcr:error -- \22%s\22.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = tail call dereferenceable_or_null(65536) i8* @malloc(i32 65536)
%5 = tail call dereferenceable_or_null(33554432) i8* @malloc(i32 33554432)
%6 = bitcast i8** %3 to i8*
%7 = icmp slt i32 %0, 2
%8 = icmp eq i8* %5, null
%9 = or i1 %7, %8
br i1 %9, label %52, label %10
10: ; preds = %2
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %46
%13 = phi i64 [ 1, %10 ], [ %47, %46 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
store i8* %15, i8** %3
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 64
br i1 %17, label %21, label %18
18: ; preds = %12
%19 = call i64 @addcr(i8* %5, i8** %3)
%20 = icmp eq i64 %19, 0
br i1 %20, label %46, label %52
21: ; preds = %12
%22 = getelementptr inbounds i8, i8* %15, i64 1
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @fread(i8* %4, i32 1, i32 65536, i32* %23)
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %4, i64 %25
%27 = call i32 @fclose(i32* %23)
%28 = icmp sgt i32 %24, 65534
br i1 %28, label %49, label %29
29: ; preds = %21
store i8 0, i8* %26
store i8* %4, i8** %3
%30 = icmp sgt i32 %24, 0
br i1 %30, label %31, label %46
31: ; preds = %29, %38
%32 = phi i8* [ %39, %38 ], [ %4, %29 ]
%33 = load i8, i8* %32
%34 = icmp ult i8 %33, 33
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = getelementptr inbounds i8, i8* %32, i64 1
store i8* %36, i8** %3
%37 = icmp ult i8* %36, %26
br i1 %37, label %38, label %46
38: ; preds = %35, %43
%39 = phi i8* [ %36, %35 ], [ %44, %43 ]
br label %31
40: ; preds = %31
%41 = call i64 @addcr(i8* %5, i8** %3)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = load i8*, i8** %3
%45 = icmp ult i8* %44, %26
br i1 %45, label %38, label %46
46: ; preds = %43, %35, %29, %18
%47 = add nuw nsw i64 %13, 1
%48 = icmp eq i64 %47, %11
br i1 %48, label %52, label %12
49: ; preds = %21
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %52
52: ; preds = %46, %18, %40, %49, %2
%53 = phi i32 [ 1, %2 ], [ 1, %49 ], [ 1, %40 ], [ 0, %46 ], [ 1, %18 ]
ret i32 %53
}