#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 EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *modified_fopen(char *, char *, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *);
int /*<<< orphan*/ parseCommandLineArgs(int, char **, char **, char **, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  char *finName = NULL;
  char *foutName = NULL;
  FILE *fin;
  FILE *fout;
  parseCommandLineArgs(argc, argv, &foutName, &finName,
                       "A scanner for the PL/0 language.");
  fin = modified_fopen(finName, "r", stdin, NULL);
  fout = modified_fopen(foutName, "w", stdout, NULL);
  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)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    0xe94(%rip),%r8
call   1030 <parseCommandLineArgs@plt>
mov    -0x18(%rbp),%rdi
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
lea    0xe9c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <modified_fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2e3b(%rip),%rax
mov    (%rax),%edx
lea    0xe7d(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <modified_fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xeb0(%rip),%r8
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <parseCommandLineArgs@plt>
mov    0x10(%rsp),%rdi
mov    0x2e7d(%rip),%rax
mov    (%rax),%edx
lea    0xead(%rip),%rsi
xor    %ecx,%ecx
call   1050 <modified_fopen@plt>
mov    %rax,%r14
mov    0x8(%rsp),%rdi
mov    0x2e4e(%rip),%rax
mov    (%rax),%edx
lea    0xe90(%rip),%rsi
xor    %ecx,%ecx
call   1050 <modified_fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"A scanner for the PL/0 language.\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [2 x i8] c"w\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
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
store i8* null, i8** %6
store i8* null, i8** %7
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @parseCommandLineArgs(i32 %10, i8** %11, i8** %7, i8** %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %6
%14 = load i32, i32* @stdin
%15 = call i32* @modified_fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32* null)
store i32* %15, i32** %8
%16 = load i8*, i8** %7
%17 = load i32, i32* @stdout
%18 = call i32* @modified_fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32* null)
store i32* %18, i32** %9
%19 = load i32*, i32** %8
%20 = call i32 @fclose(i32* %19)
%21 = load i32*, i32** %9
%22 = call i32 @fclose(i32* %21)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}

LLVM IR (-O2):
@.str = [33 x i8] c"A scanner for the PL/0 language.\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [2 x i8] c"w\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = call i32 @parseCommandLineArgs(i32 %0, i8** %1, i8** %4, i8** %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %3
%9 = load i32, i32* @stdin
%10 = call i32* @modified_fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32* null)
%11 = load i8*, i8** %4
%12 = load i32, i32* @stdout
%13 = call i32* @modified_fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32* null)
%14 = call i32 @fclose(i32* %10)
%15 = call i32 @fclose(i32* %13)
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}