#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_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ dbl_spacing(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  FILE *fin, *fout;
  if (argc != 3)
    usage(argv[0]);
  if ((fin = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "Err. opening input file, %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if ((fout = fopen(argv[2], "w")) == NULL) {
    fprintf(stderr, "Err. opening output file, %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  dbl_spacing(fin, fout);
  fclose(fin);
  fclose(fout);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     119c <main+0x2c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe55(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11f8 <main+0x88>
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xe1d(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe18(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1254 <main+0xe4>
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x28(%rbp),%edi
mov    %rax,%rdx
lea    0xde0(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <dbl_spacing@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
cmp    $0x3,%edi
je     1185 <main+0x15>
mov    (%r14),%rdi
call   1060 <usage@plt>
mov    0x8(%r14),%rdi
lea    0xe70(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11df <main+0x6f>
mov    %rax,%r15
mov    0x10(%r14),%rdi
lea    0xe77(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11ff <main+0x8f>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <dbl_spacing@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2dfa(%rip),%rax
mov    (%rax),%ebx
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xe05(%rip),%rsi
jmp    121d <main+0xad>
mov    0x2dda(%rip),%rax
mov    (%rax),%ebx
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xe04(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Err. opening input file, %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [30 x i8] c"Err. opening output file, %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @usage(i8* %13)
br label %15
15: ; preds = %10, %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %6
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %28
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i32, i32* @errno
%24 = call i8* @strerror(i32 %23)
%25 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %15
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %32, i32** %7
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %41
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = load i32, i32* @errno
%37 = call i8* @strerror(i32 %36)
%38 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %37)
%39 = load i32, i32* @EXIT_FAILURE
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %28
%42 = load i32*, i32** %6
%43 = load i32*, i32** %7
%44 = call i32 @dbl_spacing(i32* %42, i32* %43)
%45 = load i32*, i32** %6
%46 = call i32 @fclose(i32* %45)
%47 = load i32*, i32** %7
%48 = call i32 @fclose(i32* %47)
%49 = load i32, i32* @EXIT_SUCCESS
ret i32 %49
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Err. opening input file, %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [30 x i8] c"Err. opening output file, %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %7
7: ; preds = %4, %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %19
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = tail call i8* @strerror(i32 %14)
%16 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %7
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %31
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = load i32, i32* @errno
%27 = tail call i8* @strerror(i32 %26)
%28 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = tail call i32 @exit(i32 %29)
unreachable
31: ; preds = %19
%32 = tail call i32 @dbl_spacing(i32* %10, i32* %22)
%33 = tail call i32 @fclose(i32* %10)
%34 = tail call i32 @fclose(i32* %22)
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}