#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*/ RmComment(int /*<<< orphan*/ *);
int /*<<< orphan*/ close(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ *stdin;
int main(int args, char **argv) {
  FILE *fp;
  if (args == 1) {
    fp = stdin;
    RmComment(fp);
  } else {
    while (args > 1) {
      ++argv;
      --args;
      fp = fopen(*argv, "r");
      RmComment(fp);
      close(fp);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    116c <main+0x3c>
mov    0x2e91(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <RmComment@plt>
jmp    11c3 <main+0x93>
jmp    1171 <main+0x41>
cmpl   $0x1,-0x8(%rbp)
jle    11be <main+0x8e>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe62(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <RmComment@plt>
mov    -0x18(%rbp),%rdi
call   1040 <close@plt>
jmp    1171 <main+0x41>
jmp    11c3 <main+0x93>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    114d <main+0x1d>
mov    0x2ea5(%rip),%rax
mov    (%rax),%rdi
call   1030 <RmComment@plt>
jmp    119a <main+0x6a>
jle    119a <main+0x6a>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x8,%rbx
add    $0x1,%ebp
lea    0xe9e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1030 <RmComment@plt>
mov    %r15,%rdi
call   1040 <close@plt>
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
ja     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32*, i32** @stdin
store i32* %10, i32** %6
%11 = load i32*, i32** %6
%12 = call i32 @RmComment(i32* %11)
br label %30
13: ; preds = %2
br label %14
14: ; preds = %17, %13
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %29
17: ; preds = %14
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i32 1
store i8** %19, i8*** %5
%20 = load i32, i32* %4
%21 = add nsw i32 %20, -1
store i32 %21, i32* %4
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = call i32 @RmComment(i32* %25)
%27 = load i32*, i32** %6
%28 = call i32 @close(i32* %27)
br label %14
29: ; preds = %14
br label %30
30: ; preds = %29, %9
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %9, label %19
6: ; preds = %2
%7 = load i32*, i32** @stdin
%8 = tail call i32 @RmComment(i32* %7)
br label %19
9: ; preds = %4, %9
%10 = phi i8** [ %12, %9 ], [ %1, %4 ]
%11 = phi i32 [ %13, %9 ], [ %0, %4 ]
%12 = getelementptr inbounds i8*, i8** %10, i64 1
%13 = add nsw i32 %11, -1
%14 = load i8*, i8** %12
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @RmComment(i32* %15)
%17 = tail call i32 @close(i32* %15)
%18 = icmp ugt i32 %11, 2
br i1 %18, label %9, label %19
19: ; preds = %9, %4, %6
ret i32 0
}