#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 ParseInputFile(char *, int /*<<< orphan*/ *);
char *convert_path(char *);
int /*<<< orphan*/ error(char *, ...);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int main(int argc, char *argv[]) {
  char *pszInFile, *pszOutFile;
  FILE *fileOut;
  int ret;
  if (argc != 3) {
    error("Usage: hpp <inputfile> <outputfile>\n");
    exit(1);
  }
  pszInFile = convert_path(argv[1]);
  pszOutFile = convert_path(argv[2]);
  fileOut = fopen(pszOutFile, "wb");
  if (fileOut == NULL) {
    error("Cannot open output file %s", pszOutFile);
    exit(1);
  }
  ret = ParseInputFile(pszInFile, fileOut);
  fclose(fileOut);
  free(pszInFile);
  free(pszOutFile);
  return ret;
}


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     11a8 <main+0x38>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1060 <error@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <convert_path@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <convert_path@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1205 <main+0x95>
mov    -0x20(%rbp),%rsi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1060 <error@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <ParseInputFile@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    11e0 <main+0x70>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1090 <convert_path@plt>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
call   1090 <convert_path@plt>
mov    %rax,%r14
lea    0xe87(%rip),%rsi
mov    %rax,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     11f8 <main+0x88>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <ParseInputFile@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe19(%rip),%rdi
xor    %eax,%eax
call   1060 <error@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xe29(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <error@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Usage: hpp <inputfile> <outputfile>\0A\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [27 x i8] c"Cannot open output file %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i8* @convert_path(i8* %18)
store i8* %19, i8** %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i8* @convert_path(i8* %22)
store i8* %23, i8** %7
%24 = load i8*, i8** %7
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %8
%26 = load i32*, i32** %8
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %15
%29 = load i8*, i8** %7
%30 = call i32 (i8*, ...) @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %15
%33 = load i8*, i8** %6
%34 = load i32*, i32** %8
%35 = call i32 @ParseInputFile(i8* %33, i32* %34)
store i32 %35, i32* %9
%36 = load i32*, i32** %8
%37 = call i32 @fclose(i32* %36)
%38 = load i8*, i8** %6
%39 = call i32 @free(i8* %38)
%40 = load i8*, i8** %7
%41 = call i32 @free(i8* %40)
%42 = load i32, i32* %9
ret i32 %42
}

LLVM IR (-O2):
@.str = [37 x i8] c"Usage: hpp <inputfile> <outputfile>\0A\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [27 x i8] c"Cannot open output file %s\00"
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 = tail call i32 (i8*, ...) @error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i8* @convert_path(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i8* @convert_path(i8* %12)
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %7
%17 = tail call i32 (i8*, ...) @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %7
%20 = tail call i32 @ParseInputFile(i8* %10, i32* %14)
%21 = tail call i32 @fclose(i32* %14)
%22 = tail call i32 @free(i8* %10)
%23 = tail call i32 @free(i8* %13)
ret i32 %20
}