#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 */

/* Variables and functions */
char *load_file(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
char *remove_comments(char *);
int main(int argc, char **argv) {
  char *buf1, *buf2;
  if (argc < 2)
    return 0;
  buf1 = load_file(argv[1]);
  printf("----- %s -----\n\"%s\"\n", argv[1], buf1);
  buf2 = remove_comments(buf1);
  printf("----- after remove comments -----\n\"%s\"\n", buf2);
  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   $0x2,-0x8(%rbp)
jge    115c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    11ad <main+0x7d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <load_file@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <remove_comments@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jl     117d <main+0x4d>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <load_file@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rsi
lea    0xead(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <remove_comments@plt>
lea    0xea9(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [21 x i8] c"----- %s -----\0A\22%s\22\0A\00"
@.str.1 = [40 x i8] c"----- after remove comments -----\0A\22%s\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %25
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i8* @load_file(i8* %14)
store i8* %15, i8** %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i8*, i8** %6
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %19)
%21 = load i8*, i8** %6
%22 = call i8* @remove_comments(i8* %21)
store i8* %22, i8** %7
%23 = load i8*, i8** %7
%24 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %23)
store i32 0, i32* %3
br label %25
25: ; preds = %11, %10
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [21 x i8] c"----- %s -----\0A\22%s\22\0A\00"
@.str.1 = [40 x i8] c"----- after remove comments -----\0A\22%s\22\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i8* @load_file(i8* %6)
%8 = load i8*, i8** %5
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %7)
%10 = tail call i8* @remove_comments(i8* %7)
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %2, %4
ret i32 0
}