#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  char input_file_name[100], output_file_name[100], string[100], string2[100];
  FILE *input_file;
  FILE *output_file;
  int i, j = 0;
  if (argc < 4) {
    printf("\nusage: cipscat in1 in2 ... inx "
           "-o out");
    printf("\n\n");
    exit(1);
  }
  if (strcmp("-o", argv[argc - 2]) != 0) {
    printf("\nusage: cipscat in1 in2 ... inx "
           "-o out");
    exit(1);
  }
  for (i = 1; i < (argc - 2); i++) {
    if (strcmp(argv[i], argv[argc - 1]) == 0) {
      printf("\nERROR: input file %s has the "
             "same name as output file %s\n",
             argv[i], argv[argc - 1]);
      exit(2);
    }
  }
  strcpy(output_file_name, argv[argc - 1]);
  if ((output_file = fopen(output_file_name, "wt")) == NULL) {
    printf("\ncipscat: Error file %s\n", output_file_name);
    exit(1);
  }
  fputc('\n', output_file);
  sprintf(string, "   /*************************** \n");
  fputs(string, output_file);
  sprintf(string, "   * \n");
  fputs(string, output_file);
  sprintf(string, "   *   %s \n", output_file_name);
  fputs(string, output_file);
  sprintf(string, "   *   COMPOSITE FILE COMPRISING: \n");
  fputs(string, output_file);
  for (i = 1; i < (argc - 2); i++) {
    sprintf(string, "   *   %s \n", argv[i]);
    fputs(string, output_file);
  }
  sprintf(string, "   * \n");
  fputs(string, output_file);
  sprintf(string, "   ***************************\\ \n");
  fputs(string, output_file);
  fputc('\n', output_file);
  fputc('\n', output_file);
  for (i = 1; i < (argc - 2); i++) {
    strcpy(input_file_name, argv[i]);
    if ((input_file = fopen(input_file_name, "rt")) == NULL) {
      printf("\ncipscat: Error file %s\n", input_file_name);
      exit(2);
    }
    printf("\n\tcopying %s to %s", input_file_name, output_file_name);
    if (i == 1) {
      while (fgets(string, 100, input_file))
        fputs(string, output_file);
    } else {
      while (fgets(string, 100, input_file)) {
        if (strncmp(string, "#include \"cips.h\"", 15) == 0)
          j++;
        else
          fputs(string, output_file);
      }
    }
    fclose(input_file);
  }
  fclose(output_file);
  printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1e8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1203 <main+0x53>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe0f(%rip),%rdi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1242 <main+0x92>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movl   $0x1,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    12e0 <main+0x130>
mov    -0x10(%rbp),%rax
movslq -0x1e4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12c7 <main+0x117>
mov    -0x10(%rbp),%rax
movslq -0x1e4(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
jmp    12cc <main+0x11c>
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    124c <main+0x9c>
lea    -0xf0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0xd5d(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x1e0(%rbp)
cmp    $0x0,%rax
jne    1340 <main+0x190>
lea    -0xf0(%rbp),%rsi
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x1e0(%rbp),%rsi
mov    $0xa,%edi
call   1080 <fputc@plt>
lea    -0x160(%rbp),%rdi
lea    0xd25(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
lea    -0x160(%rbp),%rdi
lea    0xd1f(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
lea    -0x160(%rbp),%rdi
lea    -0xf0(%rbp),%rdx
lea    0xcf7(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
lea    -0x160(%rbp),%rdi
lea    0xcdb(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
movl   $0x1,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    1461 <main+0x2b1>
lea    -0x160(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1e4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc7a(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    1402 <main+0x252>
lea    -0x160(%rbp),%rdi
lea    0xc37(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
lea    -0x160(%rbp),%rdi
lea    0xc46(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
mov    -0x1e0(%rbp),%rsi
mov    $0xa,%edi
call   1080 <fputc@plt>
mov    -0x1e0(%rbp),%rsi
mov    $0xa,%edi
call   1080 <fputc@plt>
movl   $0x1,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    164a <main+0x49a>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1e4(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xbeb(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x1d8(%rbp)
cmp    $0x0,%rax
jne    1546 <main+0x396>
lea    -0x80(%rbp),%rsi
lea    0xb36(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
lea    -0x80(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
lea    0xbaa(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x1,-0x1e4(%rbp)
jne    15b0 <main+0x400>
jmp    1571 <main+0x3c1>
lea    -0x160(%rbp),%rdi
mov    -0x1d8(%rbp),%rdx
mov    $0x64,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     15ab <main+0x3fb>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
jmp    1571 <main+0x3c1>
jmp    162a <main+0x47a>
jmp    15b5 <main+0x405>
lea    -0x160(%rbp),%rdi
mov    -0x1d8(%rbp),%rdx
mov    $0x64,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     1625 <main+0x475>
lea    -0x160(%rbp),%rdi
lea    0xb30(%rip),%rsi
mov    $0xf,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    160d <main+0x45d>
mov    -0x1e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e8(%rbp)
jmp    1620 <main+0x470>
lea    -0x160(%rbp),%rdi
mov    -0x1e0(%rbp),%rsi
call   1070 <fputs@plt>
jmp    15b5 <main+0x405>
jmp    162a <main+0x47a>
mov    -0x1d8(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    14dd <main+0x32d>
mov    -0x1e0(%rbp),%rdi
call   1050 <fclose@plt>
lea    0x9cb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
cmp    $0x3,%edi
jle    1521 <main+0x351>
mov    %rsi,%rbx
mov    %edi,%r14d
lea    -0x2(%r14),%r13d
mov    (%rsi,%r13,8),%rsi
lea    0xe28(%rip),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    1545 <main+0x375>
add    $0xffffffff,%r14d
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
mov    (%rbx,%r14,8),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     14e1 <main+0x311>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1220 <main+0x50>
mov    (%rbx,%r14,8),%rsi
lea    0x80(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strcpy@plt>
lea    0xe0b(%rip),%rsi
mov    %rbp,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     155d <main+0x38d>
mov    %rax,%r15
mov    $0xa,%edi
mov    %rax,%rsi
call   10a0 <fputc@plt>
movups 0xdff(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xe03(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movw   $0xa,0x30(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
movl   $0x2a202020,0x10(%rsp)
2a
movl   $0xa202a,0x13(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
lea    0xdde(%rip),%r12
lea    0x80(%rsp),%rdx
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
movups 0xdc3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xdc7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0xa203a,0x30(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
mov    $0x1,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,8),%rdx
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1320 <main+0x150>
mov    %rbx,0x8(%rsp)
movl   $0xa202a,0x13(%rsp)
movl   $0x2a202020,0x10(%rsp)
2a
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
movups 0xd69(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xd6d(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movw   $0xa,0x30(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
mov    $0xa,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
mov    $0xa,%edi
mov    %r15,%rsi
call   10a0 <fputc@plt>
mov    $0x1,%r12d
lea    0xf0(%rsp),%rbp
lea    0xd4f(%rip),%r14
mov    %r13,(%rsp)
jmp    13f1 <main+0x221>
nopl   0x0(%rax)
mov    %r13,%rdi
call   1070 <fclose@plt>
add    $0x1,%r12
mov    (%rsp),%r13
cmp    %r13,%r12
lea    0xf0(%rsp),%rbp
je     14bb <main+0x2eb>
mov    0x8(%rsp),%rax
mov    (%rax,%r12,8),%rsi
mov    %rbp,%rdi
call   1050 <strcpy@plt>
mov    %rbp,%rdi
lea    0xcf0(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1501 <main+0x331>
mov    %rax,%r13
lea    0xcdb(%rip),%rdi
mov    %rbp,%rsi
lea    0x80(%rsp),%rdx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r13,%rdx
call   10b0 <fgets@plt>
cmp    $0x1,%r12
jne    1490 <main+0x2c0>
nopl   0x0(%rax)
test   %rax,%rax
je     13d0 <main+0x200>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r13,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jne    1459 <main+0x289>
jmp    13d0 <main+0x200>
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r13,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     13d0 <main+0x200>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xf,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1480 <main+0x2b0>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
jmp    1480 <main+0x2b0>
mov    %r15,%rdi
call   1070 <fclose@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx,%rbp,8),%rsi
mov    (%rbx,%r14,8),%rdx
lea    0xb3a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
lea    0xb60(%rip),%rdi
lea    0xf0(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
lea    0xad8(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xb72(%rip),%rdi
call   1060 <puts@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xab4(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xb04(%rip),%rdi
lea    0x80(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"\0Ausage: cipscat in1 in2 ... inx -o out\00"
@.str.1 = [3 x i8] c"\0A\0A\00"
@.str.2 = [3 x i8] c"-o\00"
@.str.3 = [59 x i8] c"\0AERROR: input file %s has the same name as output file %s\0A\00"
@.str.4 = [3 x i8] c"wt\00"
@.str.5 = [25 x i8] c"\0Acipscat: Error file %s\0A\00"
@.str.6 = [34 x i8] c" /*************************** \0A\00"
@.str.7 = [7 x i8] c" * \0A\00"
@.str.8 = [12 x i8] c" * %s \0A\00"
@.str.9 = [36 x i8] c" * COMPOSITE FILE COMPRISING: \0A\00"
@.str.10 = [34 x i8] c" ***************************\\ \0A\00"
@.str.11 = [3 x i8] c"rt\00"
@.str.12 = [19 x i8] c"\0A\09copying %s to %s\00"
@.str.13 = [18 x i8] c"#include \22cips.h\22\00"
@.str.14 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %21, i64 %24
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %20
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %20
store i32 1, i32* %12
br label %33
33: ; preds = %67, %32
%34 = load i32, i32* %12
%35 = load i32, i32* %4
%36 = sub nsw i32 %35, 2
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %70
38: ; preds = %33
%39 = load i8**, i8*** %5
%40 = load i32, i32* %12
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = load i8**, i8*** %5
%45 = load i32, i32* %4
%46 = sub nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %44, i64 %47
%49 = load i8*, i8** %48
%50 = call i64 @strcmp(i8* %43, i8* %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %66
52: ; preds = %38
%53 = load i8**, i8*** %5
%54 = load i32, i32* %12
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = load i8**, i8*** %5
%59 = load i32, i32* %4
%60 = sub nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %58, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %57, i8* %63)
%65 = call i32 @exit(i32 2)
unreachable
66: ; preds = %38
br label %67
67: ; preds = %66
%68 = load i32, i32* %12
%69 = add nsw i32 %68, 1
store i32 %69, i32* %12
br label %33
70: ; preds = %33
%71 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%72 = load i8**, i8*** %5
%73 = load i32, i32* %4
%74 = sub nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %72, i64 %75
%77 = load i8*, i8** %76
%78 = call i32 @strcpy(i8* %71, i8* %77)
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%80 = call i32* @fopen(i8* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %80, i32** %11
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %86
82: ; preds = %70
%83 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %83)
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %70
%87 = load i32*, i32** %11
%88 = call i32 @fputc(i8 signext 10, i32* %87)
%89 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%90 = call i32 (i8*, i8*, ...) @sprintf(i8* %89, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%91 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%92 = load i32*, i32** %11
%93 = call i32 @fputs(i8* %91, i32* %92)
%94 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%95 = call i32 (i8*, i8*, ...) @sprintf(i8* %94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%96 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%97 = load i32*, i32** %11
%98 = call i32 @fputs(i8* %96, i32* %97)
%99 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%100 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%101 = call i32 (i8*, i8*, ...) @sprintf(i8* %99, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %100)
%102 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%103 = load i32*, i32** %11
%104 = call i32 @fputs(i8* %102, i32* %103)
%105 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%106 = call i32 (i8*, i8*, ...) @sprintf(i8* %105, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%107 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%108 = load i32*, i32** %11
%109 = call i32 @fputs(i8* %107, i32* %108)
store i32 1, i32* %12
br label %110
110: ; preds = %126, %86
%111 = load i32, i32* %12
%112 = load i32, i32* %4
%113 = sub nsw i32 %112, 2
%114 = icmp slt i32 %111, %113
br i1 %114, label %115, label %129
115: ; preds = %110
%116 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%117 = load i8**, i8*** %5
%118 = load i32, i32* %12
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8*, i8** %117, i64 %119
%121 = load i8*, i8** %120
%122 = call i32 (i8*, i8*, ...) @sprintf(i8* %116, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %121)
%123 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%124 = load i32*, i32** %11
%125 = call i32 @fputs(i8* %123, i32* %124)
br label %126
126: ; preds = %115
%127 = load i32, i32* %12
%128 = add nsw i32 %127, 1
store i32 %128, i32* %12
br label %110
129: ; preds = %110
%130 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%131 = call i32 (i8*, i8*, ...) @sprintf(i8* %130, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%132 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%133 = load i32*, i32** %11
%134 = call i32 @fputs(i8* %132, i32* %133)
%135 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%136 = call i32 (i8*, i8*, ...) @sprintf(i8* %135, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
%137 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%138 = load i32*, i32** %11
%139 = call i32 @fputs(i8* %137, i32* %138)
%140 = load i32*, i32** %11
%141 = call i32 @fputc(i8 signext 10, i32* %140)
%142 = load i32*, i32** %11
%143 = call i32 @fputc(i8 signext 10, i32* %142)
store i32 1, i32* %12
br label %144
144: ; preds = %203, %129
%145 = load i32, i32* %12
%146 = load i32, i32* %4
%147 = sub nsw i32 %146, 2
%148 = icmp slt i32 %145, %147
br i1 %148, label %149, label %206
149: ; preds = %144
%150 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%151 = load i8**, i8*** %5
%152 = load i32, i32* %12
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8*, i8** %151, i64 %153
%155 = load i8*, i8** %154
%156 = call i32 @strcpy(i8* %150, i8* %155)
%157 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%158 = call i32* @fopen(i8* %157, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i32* %158, i32** %10
%159 = icmp eq i32* %158, null
br i1 %159, label %160, label %164
160: ; preds = %149
%161 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %161)
%163 = call i32 @exit(i32 2)
unreachable
164: ; preds = %149
%165 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%166 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8* %165, i8* %166)
%168 = load i32, i32* %12
%169 = icmp eq i32 %168, 1
br i1 %169, label %170, label %181
170: ; preds = %164
br label %171
171: ; preds = %176, %170
%172 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%173 = load i32*, i32** %10
%174 = call i64 @fgets(i8* %172, i32 100, i32* %173)
%175 = icmp ne i64 %174, 0
br i1 %175, label %176, label %180
176: ; preds = %171
%177 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%178 = load i32*, i32** %11
%179 = call i32 @fputs(i8* %177, i32* %178)
br label %171
180: ; preds = %171
br label %200
181: ; preds = %164
br label %182
182: ; preds = %198, %181
%183 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%184 = load i32*, i32** %10
%185 = call i64 @fgets(i8* %183, i32 100, i32* %184)
%186 = icmp ne i64 %185, 0
br i1 %186, label %187, label %199
187: ; preds = %182
%188 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%189 = call i64 @strncmp(i8* %188, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i32 15)
%190 = icmp eq i64 %189, 0
br i1 %190, label %191, label %194
191: ; preds = %187
%192 = load i32, i32* %13
%193 = add nsw i32 %192, 1
store i32 %193, i32* %13
br label %198
194: ; preds = %187
%195 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%196 = load i32*, i32** %11
%197 = call i32 @fputs(i8* %195, i32* %196)
br label %198
198: ; preds = %194, %191
br label %182
199: ; preds = %182
br label %200
200: ; preds = %199, %180
%201 = load i32*, i32** %10
%202 = call i32 @fclose(i32* %201)
br label %203
203: ; preds = %200
%204 = load i32, i32* %12
%205 = add nsw i32 %204, 1
store i32 %205, i32* %12
br label %144
206: ; preds = %144
%207 = load i32*, i32** %11
%208 = call i32 @fclose(i32* %207)
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"\0Ausage: cipscat in1 in2 ... inx -o out\00"
@.str.2 = [3 x i8] c"-o\00"
@.str.3 = [59 x i8] c"\0AERROR: input file %s has the same name as output file %s\0A\00"
@.str.4 = [3 x i8] c"wt\00"
@.str.5 = [25 x i8] c"\0Acipscat: Error file %s\0A\00"
@.str.6 = [34 x i8] c" /*************************** \0A\00"
@.str.7 = [7 x i8] c" * \0A\00"
@.str.8 = [12 x i8] c" * %s \0A\00"
@.str.9 = [36 x i8] c" * COMPOSITE FILE COMPRISING: \0A\00"
@.str.10 = [34 x i8] c" ***************************\\ \0A\00"
@.str.11 = [3 x i8] c"rt\00"
@.str.12 = [19 x i8] c"\0A\09copying %s to %s\00"
@.str.13 = [18 x i8] c"#include \22cips.h\22\00"
@str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 4
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = add nsw i32 %0, -2
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = add nsw i32 %0, -1
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
br label %28
25: ; preds = %14
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %21, %42
%29 = phi i64 [ 1, %21 ], [ %43, %42 ]
%30 = getelementptr inbounds i8*, i8** %1, i64 %29
%31 = load i8*, i8** %30
%32 = load i8*, i8** %24
%33 = tail call i64 @strcmp(i8* %31, i8* %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %42
35: ; preds = %28
%36 = and i64 %29, 4294967295
%37 = getelementptr inbounds i8*, i8** %1, i64 %36
%38 = load i8*, i8** %37
%39 = load i8*, i8** %24
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %38, i8* %39)
%41 = tail call i32 @exit(i32 2)
unreachable
42: ; preds = %28
%43 = add nuw nsw i64 %29, 1
%44 = icmp eq i64 %43, %16
br i1 %44, label %45, label %28
45: ; preds = %42
%46 = getelementptr inbounds i8*, i8** %1, i64 %23
%47 = load i8*, i8** %46
%48 = call i32 @strcpy(i8* %7, i8* %47)
%49 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %54
51: ; preds = %45
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %45
%55 = call i32 @fputc(i8 signext 10, i32* %49)
%56 = call i32 @fputs(i8* %8, i32* %49)
%57 = call i32 @fputs(i8* %8, i32* %49)
%58 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %7)
%59 = call i32 @fputs(i8* %8, i32* %49)
%60 = call i32 @fputs(i8* %8, i32* %49)
br label %61
61: ; preds = %54, %61
%62 = phi i64 [ 1, %54 ], [ %67, %61 ]
%63 = getelementptr inbounds i8*, i8** %1, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %64)
%66 = call i32 @fputs(i8* %8, i32* %49)
%67 = add nuw nsw i64 %62, 1
%68 = icmp eq i64 %67, %16
br i1 %68, label %69, label %61
69: ; preds = %61
%70 = call i32 @fputs(i8* %8, i32* %49)
%71 = call i32 @fputs(i8* %8, i32* %49)
%72 = call i32 @fputc(i8 signext 10, i32* %49)
%73 = call i32 @fputc(i8 signext 10, i32* %49)
br label %74
74: ; preds = %69, %103
%75 = phi i64 [ 1, %69 ], [ %105, %103 ]
%76 = getelementptr inbounds i8*, i8** %1, i64 %75
%77 = load i8*, i8** %76
%78 = call i32 @strcpy(i8* %6, i8* %77)
%79 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %84
81: ; preds = %74
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%83 = call i32 @exit(i32 2)
unreachable
84: ; preds = %74
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i8* %6, i8* %7)
%86 = icmp eq i64 %75, 1
%87 = call i64 @fgets(i8* %8, i32 100, i32* %79)
%88 = icmp eq i64 %87, 0
br i1 %86, label %90, label %89
89: ; preds = %84
br i1 %88, label %103, label %95
90: ; preds = %84
br i1 %88, label %103, label %91
91: ; preds = %90, %91
%92 = call i32 @fputs(i8* %8, i32* %49)
%93 = call i64 @fgets(i8* %8, i32 100, i32* %79)
%94 = icmp eq i64 %93, 0
br i1 %94, label %103, label %91
95: ; preds = %89, %100
%96 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i32 15)
%97 = icmp eq i64 %96, 0
br i1 %97, label %100, label %98
98: ; preds = %95
%99 = call i32 @fputs(i8* %8, i32* %49)
br label %100
100: ; preds = %95, %98
%101 = call i64 @fgets(i8* %8, i32 100, i32* %79)
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %95
103: ; preds = %100, %91, %89, %90
%104 = call i32 @fclose(i32* %79)
%105 = add nuw nsw i64 %75, 1
%106 = icmp eq i64 %105, %16
br i1 %106, label %107, label %74
107: ; preds = %103
%108 = call i32 @fclose(i32* %49)
%109 = call i32 @putchar(i32 10)
ret i32 0
}