#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__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ squeeze(char *, char *);
int main(int argc, char *argv[]) {
  FILE *in, *out;
  in = fopen("input.dat", "r");
  if (in == NULL) {
    perror("input.dat");
    return 1;
  }
  out = fopen("output.dat", "w");
  if (out == NULL) {
    perror("output.dat");
    return 1;
  }
  char s1[128];
  char s2[128];
  while (fscanf(in, "%s %s", s1, s2) != EOF) {
    fprintf(out, "s1='%s', s2='%s'\n", s1, s2);
    if (squeeze(s1, s2) != 0) {
      fprintf(out, "Error occured\n");
      return 1;
    }
    fprintf(out, "after squeezing: '%s'\n", s1);
  }
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe80(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b3 <main+0x53>
lea    0xe5e(%rip),%rdi
call   1080 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    12b2 <main+0x152>
lea    0xe52(%rip),%rdi
lea    0xe56(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11ed <main+0x8d>
lea    0xe30(%rip),%rdi
call   1080 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    12b2 <main+0x152>
jmp    11f2 <main+0x92>
mov    -0x18(%rbp),%rdi
lea    -0xa0(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0xe0e(%rip),%rsi
call   1050 <fscanf@plt>
mov    0x2dd1(%rip),%rcx
cmp    (%rcx),%rax
je     1299 <main+0x139>
mov    -0x20(%rbp),%rdi
lea    -0xa0(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <squeeze@plt>
cmp    $0x0,%rax
je     127b <main+0x11b>
mov    -0x20(%rbp),%rdi
lea    0xdc9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12b2 <main+0x152>
mov    -0x20(%rbp),%rdi
lea    -0xa0(%rbp),%rdx
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    11f2 <main+0x92>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xe78(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1281 <main+0x111>
mov    %rax,%r14
lea    0xe65(%rip),%rdi
lea    0xe69(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     128a <main+0x11a>
mov    %rax,%r12
lea    0xe53(%rip),%rsi
lea    0x80(%rsp),%rdx
mov    %rsp,%rcx
mov    %r14,%rdi
call   1050 <fscanf@plt>
mov    0x2e08(%rip),%rbp
cmp    0x0(%rbp),%rax
je     1252 <main+0xe2>
lea    0x80(%rsp),%rbx
mov    %rsp,%r13
lea    0xe21(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
lea    0xe15(%rip),%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <squeeze@plt>
test   %rax,%rax
jne    1266 <main+0xf6>
mov    %r12,%rdi
lea    0xe0f(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
call   1050 <fscanf@plt>
cmp    0x0(%rbp),%rax
jne    1200 <main+0x90>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    129b <main+0x12b>
lea    0xdc4(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1090 <fwrite@plt>
jmp    1296 <main+0x126>
lea    0xd78(%rip),%rdi
jmp    1291 <main+0x121>
lea    0xd7b(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"output.dat\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%s %s\00"
@EOF = global i64 0
@.str.5 = [18 x i8] c"s1='%s', s2='%s'\0A\00"
@.str.6 = [15 x i8] c"Error occured\0A\00"
@.str.7 = [23 x i8] c"after squeezing: '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [128 x i8]
%9 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %6
%11 = load i32*, i32** %6
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %50
15: ; preds = %2
%16 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %16, i32** %7
%17 = load i32*, i32** %7
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %50
21: ; preds = %15
br label %22
22: ; preds = %41, %21
%23 = load i32*, i32** %6
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%26 = call i64 @fscanf(i32* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %24, i8* %25)
%27 = load i64, i64* @EOF
%28 = icmp ne i64 %26, %27
br i1 %28, label %29, label %45
29: ; preds = %22
%30 = load i32*, i32** %7
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %31, i8* %32)
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%36 = call i64 @squeeze(i8* %34, i8* %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %29
%39 = load i32*, i32** %7
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %50
41: ; preds = %29
%42 = load i32*, i32** %7
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %43)
br label %22
45: ; preds = %22
%46 = load i32*, i32** %6
%47 = call i32 @fclose(i32* %46)
%48 = load i32*, i32** %7
%49 = call i32 @fclose(i32* %48)
store i32 0, i32* %3
br label %50
50: ; preds = %45, %38, %19, %13
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"output.dat\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [6 x i8] c"%s %s\00"
@EOF = global i64 0
@.str.5 = [18 x i8] c"s1='%s', s2='%s'\0A\00"
@.str.6 = [15 x i8] c"Error occured\0A\00"
@.str.7 = [23 x i8] c"after squeezing: '%s'\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 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 %9
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %36
9: ; preds = %2
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %36
14: ; preds = %9
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%17 = call i64 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %15, i8* %16)
%18 = load i64, i64* @EOF
%19 = icmp eq i64 %17, %18
br i1 %19, label %31, label %20
20: ; preds = %14, %26
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %15, i8* %16)
%22 = call i64 @squeeze(i8* %15, i8* %16)
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i64 14, i64 1, i32* %10)
br label %34
26: ; preds = %20
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %15)
%28 = call i64 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %15, i8* %16)
%29 = load i64, i64* @EOF
%30 = icmp eq i64 %28, %29
br i1 %30, label %31, label %20
31: ; preds = %26, %14
%32 = call i32 @fclose(i32* %5)
%33 = call i32 @fclose(i32* %10)
br label %34
34: ; preds = %31, %24
%35 = phi i32 [ 1, %24 ], [ 0, %31 ]
br label %36
36: ; preds = %34, %12, %7
%37 = phi i32 [ 1, %7 ], [ 1, %12 ], [ %35, %34 ]
ret i32 %37
}