#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 */
int /*<<< orphan*/ CloseDumpFile();
int /*<<< orphan*/ CloseImageFile();
int /*<<< orphan*/ CreateDumpFile();
int /*<<< orphan*/ DissectImageFile();
int /*<<< orphan*/ OpenImageFile(int, char **);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  printf("MinForth Kernel Image Dump Utility\n");
  printf("==================================");
  fflush(stdout);
  OpenImageFile(argc, argv);
  CreateDumpFile();
  DissectImageFile();
  CloseDumpFile();
  CloseImageFile();
  printf("\nImage dumped.\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <OpenImageFile@plt>
mov    $0x0,%al
call   1080 <CreateDumpFile@plt>
mov    $0x0,%al
call   1030 <DissectImageFile@plt>
mov    $0x0,%al
call   1070 <CloseDumpFile@plt>
mov    $0x0,%al
call   1090 <CloseImageFile@plt>
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
lea    0xe65(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <OpenImageFile@plt>
xor    %eax,%eax
call   1090 <CreateDumpFile@plt>
xor    %eax,%eax
call   1040 <DissectImageFile@plt>
xor    %eax,%eax
call   1080 <CloseDumpFile@plt>
xor    %eax,%eax
call   10a0 <CloseImageFile@plt>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"MinForth Kernel Image Dump Utility\0A\00"
@.str.1 = [35 x i8] c"==================================\00"
@stdout = global i32 0
@.str.2 = [16 x i8] c"\0AImage dumped.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @OpenImageFile(i32 %10, i8** %11)
%13 = call i32 (...) @CreateDumpFile()
%14 = call i32 (...) @DissectImageFile()
%15 = call i32 (...) @CloseDumpFile()
%16 = call i32 (...) @CloseImageFile()
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"==================================\00"
@stdout = global i32 0
@str = [35 x i8] c"MinForth Kernel Image Dump Utility\00"
@str.3 = [15 x i8] c"\0AImage dumped.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
%7 = tail call i32 @OpenImageFile(i32 %0, i8** %1)
%8 = tail call i32 (...) @CreateDumpFile()
%9 = tail call i32 (...) @DissectImageFile()
%10 = tail call i32 (...) @CloseDumpFile()
%11 = tail call i32 (...) @CloseImageFile()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}