#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 */
int /*<<< orphan*/ dofile(char, char, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  char ofs = '\034';
  char fs = ',';
  int status = 0;
  char *progname;
  FILE *f;
  int i;
  progname = (char *)malloc(strlen(argv[0]) + 1);
  strcpy(progname, argv[0]);
  while (argc > 1 && argv[1][0] == '-') {
    switch (argv[1][1]) {
    case 'c':
    case 'C':
      fs = argv[1][2];
      break;
    case 'f':
    case 'F':
      ofs = argv[1][2];
      break;
    default:
      fprintf(stderr, "%s: unknown argument %s\n", progname, argv[1]);
      fprintf(stderr, "usage: %s [-Cc] [-Fc] [filename ...]\n", progname);
      exit(1);
    }
    argc--;
    argv++;
  }
  if (argc == 1)
    dofile(ofs, fs, stdin);
  else
    for (i = 1; i < argc; i++)
      if ((f = fopen(argv[i], "r")) == NULL) {
        fprintf(stderr, "%s: can't open %s\n", progname, argv[i]);
        status = 2;
      } else {
        dofile(ofs, fs, f);
        fclose(f);
      }
  exit(status);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x1c,-0x11(%rbp)
movb   $0x2c,-0x12(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x2d(%rbp)
jle    11f4 <main+0x74>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
test   $0x1,%al
jne    1204 <main+0x84>
jmp    12be <main+0x13e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x23,%eax
ja     125c <main+0xdc>
mov    -0x38(%rbp),%rax
lea    0xdd3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2(%rax),%al
mov    %al,-0x12(%rbp)
jmp    12a4 <main+0x124>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2(%rax),%al
mov    %al,-0x11(%rbp)
jmp    12a4 <main+0x124>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe18(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11d1 <main+0x51>
cmpl   $0x1,-0x8(%rbp)
jne    12e8 <main+0x168>
mov    -0x11(%rbp),%cl
mov    -0x12(%rbp),%al
mov    0x2d13(%rip),%rdx
mov    (%rdx),%rdx
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <dofile@plt>
jmp    138a <main+0x20a>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1385 <main+0x205>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdc1(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1354 <main+0x1d4>
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x18(%rbp)
jmp    1372 <main+0x1f2>
mov    -0x11(%rbp),%cl
mov    -0x12(%rbp),%al
mov    -0x28(%rbp),%rdx
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <dofile@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1377 <main+0x1f7>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12ef <main+0x16f>
jmp    138a <main+0x20a>
mov    -0x18(%rbp),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%r15d
mov    (%rsi),%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdi
call   1080 <malloc@plt>
mov    (%rbx),%rsi
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
call   1040 <strcpy@plt>
cmp    $0x2,%r15d
jl     1219 <main+0x99>
lea    0x1(%r15),%edx
mov    $0x1c,%al
mov    $0x2c,%r12b
mov    $0x1,%r13d
lea    0xe2f(%rip),%rsi
jmp    11f1 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x2(%rcx),%r12d
add    $0x1,%r13
add    $0xffffffff,%edx
cmp    $0x2,%edx
jle    1230 <main+0xb0>
mov    (%rbx,%r13,8),%rcx
cmpb   $0x2d,(%rcx)
jne    1257 <main+0xd7>
movsbl 0x1(%rcx),%edi
add    $0xffffffbd,%edi
cmp    $0x23,%edi
ja     12da <main+0x15a>
movslq (%rsi,%rdi,4),%rdi
add    %rsi,%rdi
jmp    *%rdi
movzbl 0x2(%rcx),%eax
jmp    11e5 <main+0x65>
movl   $0x0,0xc(%rsp)
cmp    $0x1,%r15d
jne    12d1 <main+0x151>
mov    $0x1c,%al
mov    $0x2c,%r12b
mov    0x2db1(%rip),%rcx
mov    (%rcx),%rdx
movsbl %al,%edi
movsbl %r12b,%esi
call   1030 <dofile@plt>
movl   $0x0,0xc(%rsp)
mov    0xc(%rsp),%edi
call   10a0 <exit@plt>
mov    %r15d,%r15d
movsbl %al,%ebp
movl   $0x0,0xc(%rsp)
jmp    1292 <main+0x112>
nopw   0x0(%rax,%rax,1)
mov    %rax,%r14
movsbl %r12b,%esi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <dofile@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
add    $0x1,%r13
cmp    %r13,%r15
je     12d1 <main+0x151>
mov    (%rbx,%r13,8),%rdi
lea    0xe32(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
jne    1270 <main+0xf0>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
mov    (%rbx,%r13,8),%rcx
lea    0xe16(%rip),%rsi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
movl   $0x2,0xc(%rsp)
jmp    1289 <main+0x109>
mov    0xc(%rsp),%edi
call   10a0 <exit@plt>
mov    0x2cf7(%rip),%rbx
mov    (%rbx),%edi
lea    0xda6(%rip),%rsi
mov    0x10(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%edi
lea    0xda7(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"%s: unknown argument %s\0A\00"
@.str.1 = [38 x i8] c"usage: %s [-Cc] [-Fc] [filename ...]\0A\00"
@stdin = global i32* null
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [19 x i8] c"%s: can't open %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 28, i8* %6
store i8 44, i8* %7
store i32 0, i32* %8
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i64 @strlen(i8* %14)
%16 = add nsw i64 %15, 1
%17 = call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %9
%19 = load i8*, i8** %9
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @strcpy(i8* %19, i8* %22)
br label %24
24: ; preds = %67, %2
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, 1
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 45
br label %35
35: ; preds = %27, %24
%36 = phi i1 [ false, %24 ], [ %34, %27 ]
br i1 %36, label %37, label %72
37: ; preds = %35
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
switch i32 %43, label %56 [
i32 99, label %44
i32 67, label %44
i32 102, label %50
i32 70, label %50
]
44: ; preds = %37, %37
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = getelementptr inbounds i8, i8* %47, i64 2
%49 = load i8, i8* %48
store i8 %49, i8* %7
br label %67
50: ; preds = %37, %37
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = getelementptr inbounds i8, i8* %53, i64 2
%55 = load i8, i8* %54
store i8 %55, i8* %6
br label %67
56: ; preds = %37
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %9
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %58, i8* %61)
%63 = load i32, i32* @stderr
%64 = load i8*, i8** %9
%65 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %64)
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %50, %44
%68 = load i32, i32* %4
%69 = add nsw i32 %68, -1
store i32 %69, i32* %4
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i32 1
store i8** %71, i8*** %5
br label %24
72: ; preds = %35
%73 = load i32, i32* %4
%74 = icmp eq i32 %73, 1
br i1 %74, label %75, label %80
75: ; preds = %72
%76 = load i8, i8* %6
%77 = load i8, i8* %7
%78 = load i32*, i32** @stdin
%79 = call i32 @dofile(i8 signext %76, i8 signext %77, i32* %78)
br label %114
80: ; preds = %72
store i32 1, i32* %11
br label %81
81: ; preds = %110, %80
%82 = load i32, i32* %11
%83 = load i32, i32* %4
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %113
85: ; preds = %81
%86 = load i8**, i8*** %5
%87 = load i32, i32* %11
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i32* @fopen(i8* %90, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %91, i32** %10
%92 = icmp eq i32* %91, null
br i1 %92, label %93, label %102
93: ; preds = %85
%94 = load i32, i32* @stderr
%95 = load i8*, i8** %9
%96 = load i8**, i8*** %5
%97 = load i32, i32* %11
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8*, i8** %96, i64 %98
%100 = load i8*, i8** %99
%101 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %95, i8* %100)
store i32 2, i32* %8
br label %109
102: ; preds = %85
%103 = load i8, i8* %6
%104 = load i8, i8* %7
%105 = load i32*, i32** %10
%106 = call i32 @dofile(i8 signext %103, i8 signext %104, i32* %105)
%107 = load i32*, i32** %10
%108 = call i32 @fclose(i32* %107)
br label %109
109: ; preds = %102, %93
br label %110
110: ; preds = %109
%111 = load i32, i32* %11
%112 = add nsw i32 %111, 1
store i32 %112, i32* %11
br label %81
113: ; preds = %81
br label %114
114: ; preds = %113, %75
%115 = load i32, i32* %8
%116 = call i32 @exit(i32 %115)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"%s: unknown argument %s\0A\00"
@.str.1 = [38 x i8] c"usage: %s [-Cc] [-Fc] [filename ...]\0A\00"
@stdin = global i32* null
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [19 x i8] c"%s: can't open %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%5 = add nsw i64 %4, 1
%6 = tail call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to i8*
%8 = load i8*, i8** %1
%9 = tail call i32 @strcpy(i8* %7, i8* %8)
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %41
11: ; preds = %2, %36
%12 = phi i32 [ %39, %36 ], [ %0, %2 ]
%13 = phi i8** [ %16, %36 ], [ %1, %2 ]
%14 = phi i8 [ %38, %36 ], [ 44, %2 ]
%15 = phi i8 [ %37, %36 ], [ 28, %2 ]
%16 = getelementptr inbounds i8*, i8** %13, i64 1
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 45
br i1 %19, label %20, label %43
20: ; preds = %11
%21 = getelementptr inbounds i8, i8* %17, i64 1
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
switch i32 %23, label %30 [
i32 99, label %24
i32 67, label %24
i32 102, label %27
i32 70, label %27
]
24: ; preds = %20, %20
%25 = getelementptr inbounds i8, i8* %17, i64 2
%26 = load i8, i8* %25
br label %36
27: ; preds = %20, %20
%28 = getelementptr inbounds i8, i8* %17, i64 2
%29 = load i8, i8* %28
br label %36
30: ; preds = %20
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %17)
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%35 = tail call i32 @exit(i32 1)
unreachable
36: ; preds = %27, %24
%37 = phi i8 [ %29, %27 ], [ %15, %24 ]
%38 = phi i8 [ %14, %27 ], [ %26, %24 ]
%39 = add nsw i32 %12, -1
%40 = icmp sgt i32 %12, 2
br i1 %40, label %11, label %45
41: ; preds = %2
%42 = icmp eq i32 %0, 1
br i1 %42, label %45, label %68
43: ; preds = %11
%44 = zext i32 %12 to i64
br label %50
45: ; preds = %36, %41
%46 = phi i8 [ 44, %41 ], [ %38, %36 ]
%47 = phi i8 [ 28, %41 ], [ %37, %36 ]
%48 = load i32*, i32** @stdin
%49 = tail call i32 @dofile(i8 signext %47, i8 signext %46, i32* %48)
br label %68
50: ; preds = %43, %64
%51 = phi i64 [ 1, %43 ], [ %66, %64 ]
%52 = phi i32 [ 0, %43 ], [ %65, %64 ]
%53 = getelementptr inbounds i8*, i8** %13, i64 %51
%54 = load i8*, i8** %53
%55 = tail call i32* @fopen(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%56 = icmp eq i32* %55, null
br i1 %56, label %57, label %61
57: ; preds = %50
%58 = load i32, i32* @stderr
%59 = load i8*, i8** %53
%60 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %7, i8* %59)
br label %64
61: ; preds = %50
%62 = tail call i32 @dofile(i8 signext %15, i8 signext %14, i32* %55)
%63 = tail call i32 @fclose(i32* %55)
br label %64
64: ; preds = %57, %61
%65 = phi i32 [ 2, %57 ], [ %52, %61 ]
%66 = add nuw nsw i64 %51, 1
%67 = icmp eq i64 %66, %44
br i1 %67, label %68, label %50
68: ; preds = %64, %41, %45
%69 = phi i32 [ 0, %45 ], [ 0, %41 ], [ %65, %64 ]
%70 = tail call i32 @exit(i32 %69)
unreachable
}