#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 EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ _IOFBF;
int /*<<< orphan*/ append(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
scalar_t__ s_gets(char *, int);
scalar_t__ setvbuf(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(void) {
  FILE *fa, *fs;
  int files = 0;
  char file_app[81];
  char file_src[81];
  int ch;
  printf("Enter name of destination file: ");
  s_gets(file_app, 81);
  if ((fa = fopen(file_app, "a+")) == NULL) {
    fprintf(stderr, "Can't open %s\n", file_app);
    exit(EXIT_FAILURE);
  }
  if (setvbuf(fa, NULL, _IOFBF, 4096) != 0) {
    fputs("Can't create output buffer\n", stderr);
    exit(EXIT_FAILURE);
  }
  printf("Enter name of first source file (empty line to quit): ");
  while (s_gets(file_src, 81) && file_src[0] != '\0') {
    if (strcmp(file_src, file_app) == 0) {
      fputs("Can't append file to itself\n", stderr);
    } else if ((fs = fopen(file_src, "r")) == NULL) {
      fprintf(stderr, "Can't open %s\n", file_src);
    } else {
      if (setvbuf(fs, NULL, _IOFBF, 4096) != 0) {
        fputs("Can't create input buffer\n", stderr);
        continue;
      }
      append(fs, fa);
      if (ferror(fs) != 0) {
        fprintf(stderr, "Error in reading file %s\n", file_src);
      }
      if (ferror(fa) != 0) {
        fprintf(stderr, "Error in writing file %s\n", file_app);
      }
      fclose(fs);
      files++;
      printf("File %s appended\n", file_src);
      printf("Next file (empty line to quit): ");
    }
  }
  printf("Done appending. %d files appended\n", files);
  rewind(fa);
  printf("%s contents:\n*****************\n", file_app);
  while ((ch = getc(fa)) != EOF) {
    putchar(ch);
  }
  puts("\n*****************\nDone displaying");
  fclose(fa);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x51,%esi
call   1080 <s_gets@plt>
lea    -0x70(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    126a <main+0x7a>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rdx
lea    0xdcd(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d53(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1000,%ecx
call   10e0 <setvbuf@plt>
cmp    $0x0,%rax
je     12b2 <main+0xc2>
mov    0x2d42(%rip),%rax
mov    (%rax),%esi
lea    0xd94(%rip),%rdi
call   10b0 <fputs@plt>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0xd0(%rbp),%rdi
mov    $0x51,%esi
call   1080 <s_gets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xd5(%rbp)
je     12f9 <main+0x109>
movsbl -0xd0(%rbp),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd5(%rbp)
mov    -0xd5(%rbp),%al
test   $0x1,%al
jne    130c <main+0x11c>
jmp    1468 <main+0x278>
lea    -0xd0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1340 <main+0x150>
mov    0x2cab(%rip),%rax
mov    (%rax),%esi
lea    0xd50(%rip),%rdi
call   10b0 <fputs@plt>
jmp    1463 <main+0x273>
lea    -0xd0(%rbp),%rdi
lea    0xd55(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1382 <main+0x192>
mov    0x2c70(%rip),%rax
mov    (%rax),%edi
lea    -0xd0(%rbp),%rdx
lea    0xcac(%rip),%rsi
call   10d0 <fprintf@plt>
jmp    145e <main+0x26e>
mov    -0x18(%rbp),%rdi
mov    0x2c3b(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1000,%ecx
call   10e0 <setvbuf@plt>
cmp    $0x0,%rax
je     13c1 <main+0x1d1>
mov    0x2c2a(%rip),%rax
mov    (%rax),%esi
lea    0xcee(%rip),%rdi
call   10b0 <fputs@plt>
jmp    12c0 <main+0xd0>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <append@plt>
mov    -0x18(%rbp),%rdi
call   1060 <ferror@plt>
cmp    $0x0,%rax
je     13fd <main+0x20d>
mov    0x2bf0(%rip),%rax
mov    (%rax),%edi
lea    -0xd0(%rbp),%rdx
lea    0xcc8(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <ferror@plt>
cmp    $0x0,%rax
je     1429 <main+0x239>
mov    0x2bc1(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rdx
lea    0xcb6(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    -0xd0(%rbp),%rsi
lea    0xcab(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1463 <main+0x273>
jmp    12c0 <main+0xd0>
mov    -0x1c(%rbp),%esi
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <rewind@plt>
lea    -0x70(%rbp),%rsi
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1110 <getc@plt>
mov    %eax,-0xd4(%rbp)
mov    0x2b3e(%rip),%rcx
cmp    (%rcx),%eax
je     14c2 <main+0x2d2>
mov    -0xd4(%rbp),%edi
call   1030 <putchar@plt>
jmp    1494 <main+0x2a4>
lea    0xca1(%rip),%rdi
call   1050 <puts@plt>
mov    -0x10(%rbp),%rdi
call   1070 <fclose@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
lea    0xdf8(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x51,%esi
call   1080 <s_gets@plt>
lea    0xdf9(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     145b <main+0x26b>
mov    %rax,%r15
mov    0x2d85(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1000,%ecx
call   10e0 <setvbuf@plt>
test   %rax,%rax
jne    1477 <main+0x287>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xde4(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x10(%rsp),%rdi
mov    $0x51,%esi
call   1080 <s_gets@plt>
test   %rax,%rax
je     13d8 <main+0x1e8>
cmpb   $0x0,0x10(%rsp)
je     13d8 <main+0x1e8>
lea    0x10(%rsp),%rbx
lea    0x70(%rsp),%r12
mov    0x2d32(%rip),%r13
lea    0xdf6(%rip),%rbp
xor    %eax,%eax
mov    %rax,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r12,%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1332 <main+0x142>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     133f <main+0x14f>
mov    %rax,%r14
mov    0x2cde(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1000,%ecx
call   10e0 <setvbuf@plt>
test   %rax,%rax
je     1354 <main+0x164>
mov    0x0(%r13),%esi
lea    0xd9a(%rip),%rdi
call   10b0 <fputs@plt>
mov    %rbx,%rdi
mov    $0x51,%esi
call   1080 <s_gets@plt>
test   %rax,%rax
je     13d8 <main+0x1e8>
cmpb   $0x0,0x10(%rsp)
jne    12c0 <main+0xd0>
jmp    13d8 <main+0x1e8>
mov    0x0(%r13),%esi
lea    0xd49(%rip),%rdi
jmp    130b <main+0x11b>
mov    0x0(%r13),%edi
lea    0xcda(%rip),%rsi
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
jmp    1310 <main+0x120>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <append@plt>
mov    %r14,%rdi
call   1060 <ferror@plt>
test   %rax,%rax
je     137f <main+0x18f>
mov    0x0(%r13),%edi
lea    0xd49(%rip),%rsi
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
mov    %r15,%rdi
call   1060 <ferror@plt>
test   %rax,%rax
je     139f <main+0x1af>
mov    0x0(%r13),%edi
lea    0xd43(%rip),%rsi
mov    %r12,%rdx
call   10d0 <fprintf@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
lea    0xd39(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xd3a(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1310 <main+0x120>
lea    0xd48(%rip),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r15,%rdi
call   10a0 <rewind@plt>
lea    0xd50(%rip),%rdi
lea    0x70(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r15,%rdi
call   1110 <getc@plt>
mov    0x2bd3(%rip),%rbx
cmp    (%rbx),%eax
je     1433 <main+0x243>
nopl   0x0(%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   1110 <getc@plt>
cmp    (%rbx),%eax
jne    1420 <main+0x230>
lea    0xd30(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1070 <fclose@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b76(%rip),%rax
mov    (%rax),%edi
lea    0xbb9(%rip),%rsi
lea    0x70(%rsp),%rdx
call   10d0 <fprintf@plt>
jmp    148c <main+0x29c>
mov    0x2b5a(%rip),%rax
mov    (%rax),%esi
lea    0xbac(%rip),%rdi
call   10b0 <fputs@plt>
mov    0x2b3d(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Enter name of destination file: \00"
@.str.1 = [3 x i8] c"a+\00"
@stderr = global i32 0
@.str.2 = [15 x i8] c"Can't open %s\0A\00"
@EXIT_FAILURE = global i32 0
@_IOFBF = global i32 0
@.str.3 = [28 x i8] c"Can't create output buffer\0A\00"
@.str.4 = [55 x i8] c"Enter name of first source file (empty line to quit): \00"
@.str.5 = [29 x i8] c"Can't append file to itself\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [27 x i8] c"Can't create input buffer\0A\00"
@.str.8 = [26 x i8] c"Error in reading file %s\0A\00"
@.str.9 = [26 x i8] c"Error in writing file %s\0A\00"
@.str.10 = [18 x i8] c"File %s appended\0A\00"
@.str.11 = [33 x i8] c"Next file (empty line to quit): \00"
@.str.12 = [35 x i8] c"Done appending. %d files appended\0A\00"
@.str.13 = [32 x i8] c"%s contents:\0A*****************\0A\00"
@EOF = global i32 0
@.str.14 = [35 x i8] c"\0A*****************\0ADone displaying\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [81 x i8]
%6 = alloca [81 x i8]
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%10 = call i64 @s_gets(i8* %9, i32 81)
%11 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %2
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %20
14: ; preds = %0
%15 = load i32, i32* @stderr
%16 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %0
%21 = load i32*, i32** %2
%22 = load i32, i32* @_IOFBF
%23 = call i64 @setvbuf(i32* %21, i32* null, i32 %22, i32 4096)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %20
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %95, %64, %30
%33 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%34 = call i64 @s_gets(i8* %33, i32 81)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 0
br label %41
41: ; preds = %36, %32
%42 = phi i1 [ false, %32 ], [ %40, %36 ]
br i1 %42, label %43, label %96
43: ; preds = %41
%44 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%45 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%46 = call i64 @strcmp(i8* %44, i8* %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %49)
br label %95
51: ; preds = %43
%52 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%53 = call i32* @fopen(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %53, i32** %3
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %59
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%58 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %57)
br label %94
59: ; preds = %51
%60 = load i32*, i32** %3
%61 = load i32, i32* @_IOFBF
%62 = call i64 @setvbuf(i32* %60, i32* null, i32 %61, i32 4096)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %59
%65 = load i32, i32* @stderr
%66 = call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %65)
br label %32
67: ; preds = %59
%68 = load i32*, i32** %3
%69 = load i32*, i32** %2
%70 = call i32 @append(i32* %68, i32* %69)
%71 = load i32*, i32** %3
%72 = call i64 @ferror(i32* %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %78
74: ; preds = %67
%75 = load i32, i32* @stderr
%76 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%77 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %74, %67
%79 = load i32*, i32** %2
%80 = call i64 @ferror(i32* %79)
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %86
82: ; preds = %78
%83 = load i32, i32* @stderr
%84 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%85 = call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %84)
br label %86
86: ; preds = %82, %78
%87 = load i32*, i32** %3
%88 = call i32 @fclose(i32* %87)
%89 = load i32, i32* %4
%90 = add nsw i32 %89, 1
store i32 %90, i32* %4
%91 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %91)
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
br label %94
94: ; preds = %86, %55
br label %95
95: ; preds = %94, %48
br label %32
96: ; preds = %41
%97 = load i32, i32* %4
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i32 %97)
%99 = load i32*, i32** %2
%100 = call i32 @rewind(i32* %99)
%101 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* %101)
br label %103
103: ; preds = %108, %96
%104 = load i32*, i32** %2
%105 = call i32 @getc(i32* %104)
store i32 %105, i32* %7
%106 = load i32, i32* @EOF
%107 = icmp ne i32 %105, %106
br i1 %107, label %108, label %111
108: ; preds = %103
%109 = load i32, i32* %7
%110 = call i32 @putchar(i32 %109)
br label %103
111: ; preds = %103
%112 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0))
%113 = load i32*, i32** %2
%114 = call i32 @fclose(i32* %113)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Enter name of destination file: \00"
@.str.1 = [3 x i8] c"a+\00"
@stderr = global i32 0
@.str.2 = [15 x i8] c"Can't open %s\0A\00"
@EXIT_FAILURE = global i32 0
@_IOFBF = global i32 0
@.str.3 = [28 x i8] c"Can't create output buffer\0A\00"
@.str.4 = [55 x i8] c"Enter name of first source file (empty line to quit): \00"
@.str.5 = [29 x i8] c"Can't append file to itself\0A\00"
@.str.6 = [2 x i8] c"r\00"
@.str.7 = [27 x i8] c"Can't create input buffer\0A\00"
@.str.8 = [26 x i8] c"Error in reading file %s\0A\00"
@.str.9 = [26 x i8] c"Error in writing file %s\0A\00"
@.str.10 = [18 x i8] c"File %s appended\0A\00"
@.str.11 = [33 x i8] c"Next file (empty line to quit): \00"
@.str.12 = [35 x i8] c"Done appending. %d files appended\0A\00"
@.str.13 = [32 x i8] c"%s contents:\0A*****************\0A\00"
@EOF = global i32 0
@.str.14 = [35 x i8] c"\0A*****************\0ADone displaying\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = alloca [81 x i8]
%3 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @s_gets(i8* %3, i32 81)
%7 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %0
%15 = load i32, i32* @_IOFBF
%16 = call i64 @setvbuf(i32* %7, i32* null, i32 %15, i32 4096)
%17 = icmp eq i64 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %14
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0))
%25 = call i64 @s_gets(i8* %4, i32 81)
%26 = icmp ne i64 %25, 0
%27 = load i8, i8* %4
%28 = icmp ne i8 %27, 0
%29 = select i1 %26, i1 %28, i1 false
br i1 %29, label %30, label %81
30: ; preds = %23, %74
%31 = phi i32 [ %75, %74 ], [ 0, %23 ]
br label %32
32: ; preds = %30, %48
%33 = call i64 @strcmp(i8* %4, i8* %3)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %36)
br label %74
38: ; preds = %32
%39 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %74
44: ; preds = %38
%45 = load i32, i32* @_IOFBF
%46 = call i64 @setvbuf(i32* %39, i32* null, i32 %45, i32 4096)
%47 = icmp eq i64 %46, 0
br i1 %47, label %56, label %48
48: ; preds = %44
%49 = load i32, i32* @stderr
%50 = call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %49)
%51 = call i64 @s_gets(i8* %4, i32 81)
%52 = icmp ne i64 %51, 0
%53 = load i8, i8* %4
%54 = icmp ne i8 %53, 0
%55 = select i1 %52, i1 %54, i1 false
br i1 %55, label %32, label %81
56: ; preds = %44
%57 = call i32 @append(i32* %39, i32* %7)
%58 = call i64 @ferror(i32* %39)
%59 = icmp eq i64 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %56
%61 = load i32, i32* @stderr
%62 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %4)
br label %63
63: ; preds = %60, %56
%64 = call i64 @ferror(i32* %7)
%65 = icmp eq i64 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %63
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %3)
br label %69
69: ; preds = %66, %63
%70 = call i32 @fclose(i32* %39)
%71 = add nsw i32 %31, 1
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %4)
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
br label %74
74: ; preds = %41, %69, %35
%75 = phi i32 [ %31, %35 ], [ %31, %41 ], [ %71, %69 ]
%76 = call i64 @s_gets(i8* %4, i32 81)
%77 = icmp ne i64 %76, 0
%78 = load i8, i8* %4
%79 = icmp ne i8 %78, 0
%80 = select i1 %77, i1 %79, i1 false
br i1 %80, label %30, label %81
81: ; preds = %74, %48, %23
%82 = phi i32 [ 0, %23 ], [ %31, %48 ], [ %75, %74 ]
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i32 %82)
%84 = call i32 @rewind(i32* %7)
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* %3)
%86 = call i32 @getc(i32* %7)
%87 = load i32, i32* @EOF
%88 = icmp eq i32 %86, %87
br i1 %88, label %95, label %89
89: ; preds = %81, %89
%90 = phi i32 [ %92, %89 ], [ %86, %81 ]
%91 = call i32 @putchar(i32 %90)
%92 = call i32 @getc(i32* %7)
%93 = load i32, i32* @EOF
%94 = icmp eq i32 %92, %93
br i1 %94, label %95, label %89
95: ; preds = %89, %81
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.14, i64 0, i64 0))
%97 = call i32 @fclose(i32* %7)
ret i32 0
}