#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 */
struct maze {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ destroy_maze(struct maze *);
int /*<<< orphan*/ free(struct maze *);
struct maze *read_map(char *);
int /*<<< orphan*/ write_map(struct maze *, char *);
int main() {
  char *input_file = "mazes/mazeFile1.txt";
  char *output_file = "mazes/mazeFile2.txt";
  char *output_file2 = "mazes/mazeFile3.txt";
  struct maze *maze;
  maze = read_map(input_file);
  write_map(maze, output_file);
  destroy_maze(maze);
  free(maze);
  maze = read_map(output_file);
  write_map(maze, output_file2);
  destroy_maze(maze);
  free(maze);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xebc(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <read_map@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <write_map@plt>
mov    -0x28(%rbp),%rdi
call   1050 <destroy_maze@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <read_map@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <write_map@plt>
mov    -0x28(%rbp),%rdi
call   1050 <destroy_maze@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
call   1040 <read_map@plt>
mov    %rax,%rbx
lea    0xeba(%rip),%r14
mov    %rax,%rdi
mov    %r14,%rsi
call   1060 <write_map@plt>
mov    %rbx,%rdi
call   1050 <destroy_maze@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1040 <read_map@plt>
mov    %rax,%rbx
lea    0xea1(%rip),%rsi
mov    %rax,%rdi
call   1060 <write_map@plt>
mov    %rbx,%rdi
call   1050 <destroy_maze@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.maze = type { i32 }
@.str = [20 x i8] c"mazes/mazeFile1.txt\00"
@.str.1 = [20 x i8] c"mazes/mazeFile2.txt\00"
@.str.2 = [20 x i8] c"mazes/mazeFile3.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.maze*
store i32 0, i32* %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8** %4
%6 = load i8*, i8** %2
%7 = call %struct.maze* @read_map(i8* %6)
store %struct.maze* %7, %struct.maze** %5
%8 = load %struct.maze*, %struct.maze** %5
%9 = load i8*, i8** %3
%10 = call i32 @write_map(%struct.maze* %8, i8* %9)
%11 = load %struct.maze*, %struct.maze** %5
%12 = call i32 @destroy_maze(%struct.maze* %11)
%13 = load %struct.maze*, %struct.maze** %5
%14 = call i32 @free(%struct.maze* %13)
%15 = load i8*, i8** %3
%16 = call %struct.maze* @read_map(i8* %15)
store %struct.maze* %16, %struct.maze** %5
%17 = load %struct.maze*, %struct.maze** %5
%18 = load i8*, i8** %4
%19 = call i32 @write_map(%struct.maze* %17, i8* %18)
%20 = load %struct.maze*, %struct.maze** %5
%21 = call i32 @destroy_maze(%struct.maze* %20)
%22 = load %struct.maze*, %struct.maze** %5
%23 = call i32 @free(%struct.maze* %22)
ret i32 0
}

LLVM IR (-O2):
%struct.maze = type { i32 }
@.str = [20 x i8] c"mazes/mazeFile1.txt\00"
@.str.1 = [20 x i8] c"mazes/mazeFile2.txt\00"
@.str.2 = [20 x i8] c"mazes/mazeFile3.txt\00"
define i32 @main() {
%1 = tail call %struct.maze* @read_map(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write_map(%struct.maze* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @destroy_maze(%struct.maze* %1)
%4 = tail call i32 @free(%struct.maze* %1)
%5 = tail call %struct.maze* @read_map(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @write_map(%struct.maze* %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @destroy_maze(%struct.maze* %5)
%8 = tail call i32 @free(%struct.maze* %5)
ret i32 0
}