#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__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  FILE *inputFile1, *inputFile2, *outputFile;
  char lineBuf1[160] = {0};
  char lineBuf2[160] = {0};
  if ((inputFile1 = fopen("input1", "r")) == NULL) {
    printf("Cannot open input1!\n");
    exit(1);
  }
  if ((inputFile2 = fopen("input2", "r")) == NULL) {
    printf("Cannot open input2!\n");
    exit(1);
  }
  if ((outputFile = fopen("output", "w")) == NULL) {
    printf("Cannot open output!\n");
    exit(1);
  }
  while (1) {
    fscanf(inputFile1, "%[^\n]\n", lineBuf1);
    fscanf(inputFile2, "%[^\n]\n", lineBuf2);
    fprintf(outputFile, "%s\n", lineBuf1);
    fprintf(outputFile, "%s\n", lineBuf2);
    if (feof(inputFile1) || feof(inputFile2))
      break;
  }
  while (!feof(inputFile1)) {
    fscanf(inputFile1, "%[^\n]\n", lineBuf1);
    printf("%s\n", lineBuf1);
  }
  while (!feof(inputFile2)) {
    fscanf(inputFile2, "%[^\n]\n", lineBuf2);
    printf("%s\n", lineBuf2);
  }
  fclose(inputFile1);
  fclose(inputFile2);
  fclose(outputFile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0xa0,%edx
call   1050 <memset@plt>
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0xa0,%edx
call   1050 <memset@plt>
lea    0xe41(%rip),%rdi
lea    0xe41(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11f1 <main+0x71>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe26(%rip),%rdi
lea    0xe08(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    122a <main+0xaa>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe09(%rip),%rdi
lea    0xe09(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1263 <main+0xe3>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    1268 <main+0xe8>
mov    -0x10(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
lea    0xdde(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x160(%rbp),%rdx
lea    0xdc7(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
lea    0xdb7(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x160(%rbp),%rdx
lea    0xda0(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
jne    12ea <main+0x16a>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
je     12ef <main+0x16f>
jmp    12f4 <main+0x174>
jmp    1268 <main+0xe8>
jmp    12f9 <main+0x179>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1318 <main+0x198>
jmp    1349 <main+0x1c9>
mov    -0x10(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
lea    0xd2e(%rip),%rsi
call   1060 <fscanf@plt>
lea    -0xc0(%rbp),%rsi
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f9 <main+0x179>
jmp    134e <main+0x1ce>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    136d <main+0x1ed>
jmp    139e <main+0x21e>
mov    -0x18(%rbp),%rdi
lea    -0x160(%rbp),%rdx
lea    0xcd9(%rip),%rsi
call   1060 <fscanf@plt>
lea    -0x160(%rbp),%rsi
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    134e <main+0x1ce>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xdea(%rip),%rdi
lea    0xdea(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13a1 <main+0x231>
mov    %rax,%r14
lea    0xdd4(%rip),%rdi
lea    0xdcb(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13aa <main+0x23a>
mov    %rax,%r12
lea    0xdbc(%rip),%rdi
lea    0xdbc(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     13b3 <main+0x243>
mov    0x8(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
lea    0xd8f(%rip),%r15
mov    %r15,%rsi
lea    0xb0(%rsp),%r13
mov    %r13,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %rbp,%rdi
lea    0xd66(%rip),%rbx
mov    %rbx,%rsi
mov    %r13,%rdx
call   1060 <fprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    12ed <main+0x17d>
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
je     1280 <main+0x110>
mov    %r14,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    1333 <main+0x1c3>
lea    0xd18(%rip),%rbx
lea    0xb0(%rsp),%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <fscanf@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1070 <feof@plt>
test   %rax,%rax
je     1310 <main+0x1a0>
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    1373 <main+0x203>
lea    0xcd2(%rip),%rbx
lea    0x10(%rsp),%rbp
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <fscanf@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
je     1350 <main+0x1e0>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xca4(%rip),%rdi
jmp    13ba <main+0x24a>
lea    0xc87(%rip),%rdi
jmp    13ba <main+0x24a>
lea    0xc6a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"input1\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Cannot open input1!\0A\00"
@.str.3 = [7 x i8] c"input2\00"
@.str.4 = [21 x i8] c"Cannot open input2!\0A\00"
@.str.5 = [7 x i8] c"output\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [21 x i8] c"Cannot open output!\0A\00"
@.str.8 = [7 x i8] c"%[^\0A]\0A\00"
@.str.9 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [160 x i8]
%6 = alloca [160 x i8]
store i32 0, i32* %1
%7 = bitcast [160 x i8]* %5 to i8*
%8 = bitcast [160 x i8]* %6 to i8*
%9 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %2
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %3
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %14
%21 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %21, i32** %4
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %20
br label %27
27: ; preds = %26, %48
%28 = load i32*, i32** %2
%29 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 0
%30 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %29)
%31 = load i32*, i32** %3
%32 = getelementptr inbounds [160 x i8], [160 x i8]* %6, i64 0, i64 0
%33 = call i32 @fscanf(i32* %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %32)
%34 = load i32*, i32** %4
%35 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 0
%36 = call i32 @fprintf(i32* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %35)
%37 = load i32*, i32** %4
%38 = getelementptr inbounds [160 x i8], [160 x i8]* %6, i64 0, i64 0
%39 = call i32 @fprintf(i32* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %38)
%40 = load i32*, i32** %2
%41 = call i64 @feof(i32* %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %27
%44 = load i32*, i32** %3
%45 = call i64 @feof(i32* %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %43, %27
br label %49
48: ; preds = %43
br label %27
49: ; preds = %47
br label %50
50: ; preds = %55, %49
%51 = load i32*, i32** %2
%52 = call i64 @feof(i32* %51)
%53 = icmp ne i64 %52, 0
%54 = xor i1 %53, true
br i1 %54, label %55, label %61
55: ; preds = %50
%56 = load i32*, i32** %2
%57 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 0
%58 = call i32 @fscanf(i32* %56, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %57)
%59 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 0
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %59)
br label %50
61: ; preds = %50
br label %62
62: ; preds = %67, %61
%63 = load i32*, i32** %3
%64 = call i64 @feof(i32* %63)
%65 = icmp ne i64 %64, 0
%66 = xor i1 %65, true
br i1 %66, label %67, label %73
67: ; preds = %62
%68 = load i32*, i32** %3
%69 = getelementptr inbounds [160 x i8], [160 x i8]* %6, i64 0, i64 0
%70 = call i32 @fscanf(i32* %68, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %69)
%71 = getelementptr inbounds [160 x i8], [160 x i8]* %6, i64 0, i64 0
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %71)
br label %62
73: ; preds = %62
%74 = load i32*, i32** %2
%75 = call i32 @fclose(i32* %74)
%76 = load i32*, i32** %3
%77 = call i32 @fclose(i32* %76)
%78 = load i32*, i32** %4
%79 = call i32 @fclose(i32* %78)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"input1\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [7 x i8] c"input2\00"
@.str.5 = [7 x i8] c"output\00"
@.str.6 = [2 x i8] c"w\00"
@.str.8 = [7 x i8] c"%[^\0A]\0A\00"
@.str.9 = [4 x i8] c"%s\0A\00"
@str = [20 x i8] c"Cannot open output!\00"
@str.10 = [20 x i8] c"Cannot open input2!\00"
@str.11 = [20 x i8] c"Cannot open input1!\00"
define i32 @main() {
%1 = alloca [160 x i8]
%2 = alloca [160 x i8]
%3 = getelementptr inbounds [160 x i8], [160 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [160 x i8], [160 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.10, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %10
%17 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %16, %29
%23 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %3)
%24 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%25 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %3)
%26 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %4)
%27 = call i64 @feof(i32* %5)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = call i64 @feof(i32* %11)
%31 = icmp eq i64 %30, 0
br i1 %31, label %22, label %32
32: ; preds = %22, %29
%33 = call i64 @feof(i32* %5)
%34 = icmp eq i64 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %38, %32
%36 = call i64 @feof(i32* %11)
%37 = icmp eq i64 %36, 0
br i1 %37, label %43, label %48
38: ; preds = %32, %38
%39 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %3)
%40 = call i32 @puts(i8* %3)
%41 = call i64 @feof(i32* %5)
%42 = icmp eq i64 %41, 0
br i1 %42, label %38, label %35
43: ; preds = %35, %43
%44 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%45 = call i32 @puts(i8* %4)
%46 = call i64 @feof(i32* %11)
%47 = icmp eq i64 %46, 0
br i1 %47, label %43, label %48
48: ; preds = %43, %35
%49 = call i32 @fclose(i32* %5)
%50 = call i32 @fclose(i32* %11)
%51 = call i32 @fclose(i32* %17)
ret i32 0
}