#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*/ buf_In;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int /*<<< orphan*/,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ remove_Comments(char *);
int /*<<< orphan*/ strlen(char *);
void remove_Comments_File(char *psz_file_in, char *psz_file_out) {
  FILE *pFile_In = fopen(psz_file_in, "r");
  if (pFile_In == NULL) {
    return;
  }
  FILE *pFile_Out = fopen(psz_file_out, "w");
  if (pFile_Out == NULL) {
    fclose(pFile_In);
    return;
  }
  char buf_In[4096];
  int len = fread(buf_In, 1, sizeof(buf_In) - 1, pFile_In);
  while (len > 0) {
    buf_In[len] = '\0';
    remove_Comments(buf_In);
    fwrite(buf_In, 1, strlen(buf_In), pFile_Out);
    len = fread(buf_In, 1, sizeof(buf_In) - 1, pFile_In);
  }
  fclose(pFile_In);
  fclose(pFile_Out);
  return;
}


x86 assembly (clang, -O0):
<remove_Comments_File>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1197 <remove_Comments_File+0x37>
jmp    1274 <remove_Comments_File+0x114>
mov    -0x10(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c4 <remove_Comments_File+0x64>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1274 <remove_Comments_File+0x114>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0xfff,%edx
call   1040 <fread@plt>
mov    %eax,-0x1024(%rbp)
cmpl   $0x0,-0x1024(%rbp)
jle    1262 <remove_Comments_File+0x102>
movslq -0x1024(%rbp),%rax
movb   $0x0,-0x1020(%rbp,%rax,1)
lea    -0x1020(%rbp),%rdi
call   1030 <remove_Comments@plt>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1030(%rbp)
lea    -0x1020(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x1030(%rbp),%rdi
mov    %eax,%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1080 <fwrite@plt>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0xfff,%edx
call   1040 <fread@plt>
mov    %eax,-0x1024(%rbp)
jmp    11e4 <remove_Comments_File+0x84>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_Comments_File>:
push   %r15
push   %r14
push   %rbx
sub    $0x1000,%rsp
mov    %rsi,%rbx
lea    0xe8a(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1211 <remove_Comments_File+0xb1>
mov    %rax,%r15
lea    0xe74(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     121e <remove_Comments_File+0xbe>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0xfff,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
test   %eax,%eax
jle    1201 <remove_Comments_File+0xa1>
mov    %rsp,%rbx
xchg   %ax,%ax
mov    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rbx,%rdi
call   1030 <remove_Comments@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xfff,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
test   %eax,%eax
jg     11c0 <remove_Comments_File+0x60>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
add    $0x1000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r15,%rdi
add    $0x1000,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
define void @remove_Comments_File(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [4096 x i8]
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %5
%11 = load i32*, i32** %5
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
br label %48
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32*, i32** %5
%21 = call i32 @fclose(i32* %20)
br label %48
22: ; preds = %14
%23 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%24 = load i32*, i32** %5
%25 = call i32 @fread(i8* %23, i32 1, i32 4095, i32* %24)
store i32 %25, i32* %8
br label %26
26: ; preds = %29, %22
%27 = load i32, i32* %8
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %31
store i8 0, i8* %32
%33 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%34 = call i32 @remove_Comments(i8* %33)
%35 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%36 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = load i32*, i32** %6
%39 = call i32 @fwrite(i8* %35, i32 1, i32 %37, i32* %38)
%40 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%41 = load i32*, i32** %5
%42 = call i32 @fread(i8* %40, i32 1, i32 4095, i32* %41)
store i32 %42, i32* %8
br label %26
43: ; preds = %26
%44 = load i32*, i32** %5
%45 = call i32 @fclose(i32* %44)
%46 = load i32*, i32** %6
%47 = call i32 @fclose(i32* %46)
br label %48
48: ; preds = %43, %19, %13
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
define void @remove_Comments_File(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca [4096 x i8]
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %27, label %6
6: ; preds = %2
%7 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @fclose(i32* %4)
br label %27
11: ; preds = %6
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%13 = call i32 @fread(i8* %12, i32 1, i32 4095, i32* %4)
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %11, %15
%16 = phi i32 [ %22, %15 ], [ %13, %11 ]
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %17
store i8 0, i8* %18
%19 = call i32 @remove_Comments(i8* %12)
%20 = call i32 @strlen(i8* %12)
%21 = call i32 @fwrite(i8* %12, i32 1, i32 %20, i32* %7)
%22 = call i32 @fread(i8* %12, i32 1, i32 4095, i32* %4)
%23 = icmp sgt i32 %22, 0
br i1 %23, label %15, label %24
24: ; preds = %15, %11
%25 = call i32 @fclose(i32* %4)
%26 = call i32 @fclose(i32* %7)
br label %27
27: ; preds = %9, %24, %2
ret void
}