#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
void dohelp(int man) {
  puts("Usage: simfunge kernel.elf [program.bf]");
  if (man) {
    puts("");
    puts("  kernel.elf should be a binary file in ELF format, as");
    puts("produced by the fungasm assembler. It will be loaded first.");
    puts("Think of kernel.elf as a \"kernel\" for the system --- it");
    puts("could be a Befunge interpreter, for example. It will typically");
    puts("occupy \"kernel space\" at the bottom of RAM, although you");
    puts("can put it anywhere you like; the loader simply follows what's");
    puts("specified in the ELF file.");
    puts("  program.bf should be an ASCII file, at most 80 columns by");
    puts("25 rows. It will be loaded into the top of memory. This is for");
    puts("the convenience of users who already have a \"kernel.elf\"");
    puts("that interprets Befunge. If you don't have such a kernel, then");
    puts("this option probably won't help you.");
  }
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<dohelp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,-0x4(%rbp)
je     11dd <dohelp+0xbd>
lea    0x1110(%rip),%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf8e(%rip),%rdi
call   1030 <puts@plt>
lea    0xfbb(%rip),%rdi
call   1030 <puts@plt>
lea    0xfee(%rip),%rdi
call   1030 <puts@plt>
lea    0xffd(%rip),%rdi
call   1030 <puts@plt>
lea    0x102d(%rip),%rdi
call   1030 <puts@plt>
lea    0x1060(%rip),%rdi
call   1030 <puts@plt>
lea    0x108d(%rip),%rdi
call   1030 <puts@plt>
lea    0x10c0(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<dohelp>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
je     11e1 <dohelp+0xb1>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xed0(%rip),%rdi
call   1040 <puts@plt>
lea    0xefb(%rip),%rdi
call   1040 <puts@plt>
lea    0xf2b(%rip),%rdi
call   1040 <puts@plt>
lea    0xf57(%rip),%rdi
call   1040 <puts@plt>
lea    0xf8a(%rip),%rdi
call   1040 <puts@plt>
lea    0xfb7(%rip),%rdi
call   1040 <puts@plt>
lea    0xfea(%rip),%rdi
call   1040 <puts@plt>
lea    0xff9(%rip),%rdi
call   1040 <puts@plt>
lea    0x1029(%rip),%rdi
call   1040 <puts@plt>
lea    0x105c(%rip),%rdi
call   1040 <puts@plt>
lea    0x1089(%rip),%rdi
call   1040 <puts@plt>
lea    0x10bc(%rip),%rdi
call   1040 <puts@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Usage: simfunge kernel.elf [program.bf]\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [55 x i8] c" kernel.elf should be a binary file in ELF format, as\00"
@.str.3 = [60 x i8] c"produced by the fungasm assembler. It will be loaded first.\00"
@.str.4 = [56 x i8] c"Think of kernel.elf as a \22kernel\22 for the system --- it\00"
@.str.5 = [63 x i8] c"could be a Befunge interpreter, for example. It will typically\00"
@.str.6 = [57 x i8] c"occupy \22kernel space\22 at the bottom of RAM, although you\00"
@.str.7 = [63 x i8] c"can put it anywhere you like; the loader simply follows what's\00"
@.str.8 = [27 x i8] c"specified in the ELF file.\00"
@.str.9 = [60 x i8] c" program.bf should be an ASCII file, at most 80 columns by\00"
@.str.10 = [63 x i8] c"25 rows. It will be loaded into the top of memory. This is for\00"
@.str.11 = [57 x i8] c"the convenience of users who already have a \22kernel.elf\22\00"
@.str.12 = [63 x i8] c"that interprets Befunge. If you don't have such a kernel, then\00"
@.str.13 = [37 x i8] c"this option probably won't help you.\00"
@EXIT_FAILURE = global i32 0
define void @dohelp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %20
6: ; preds = %1
%7 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @puts(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @puts(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @puts(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0))
%16 = call i32 @puts(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.10, i64 0, i64 0))
%17 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0))
%18 = call i32 @puts(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.12, i64 0, i64 0))
%19 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
br label %20
20: ; preds = %6, %1
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
}

LLVM IR (-O2):
@.str = [40 x i8] c"Usage: simfunge kernel.elf [program.bf]\00"
@.str.2 = [55 x i8] c" kernel.elf should be a binary file in ELF format, as\00"
@.str.3 = [60 x i8] c"produced by the fungasm assembler. It will be loaded first.\00"
@.str.4 = [56 x i8] c"Think of kernel.elf as a \22kernel\22 for the system --- it\00"
@.str.5 = [63 x i8] c"could be a Befunge interpreter, for example. It will typically\00"
@.str.6 = [57 x i8] c"occupy \22kernel space\22 at the bottom of RAM, although you\00"
@.str.7 = [63 x i8] c"can put it anywhere you like; the loader simply follows what's\00"
@.str.8 = [27 x i8] c"specified in the ELF file.\00"
@.str.9 = [60 x i8] c" program.bf should be an ASCII file, at most 80 columns by\00"
@.str.10 = [63 x i8] c"25 rows. It will be loaded into the top of memory. This is for\00"
@.str.11 = [57 x i8] c"the convenience of users who already have a \22kernel.elf\22\00"
@.str.12 = [63 x i8] c"that interprets Befunge. If you don't have such a kernel, then\00"
@.str.13 = [37 x i8] c"this option probably won't help you.\00"
@EXIT_FAILURE = global i32 0
define void @dohelp(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %0, 0
br i1 %3, label %18, label %4
4: ; preds = %1
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.10, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.12, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
br label %18
18: ; preds = %4, %1
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
}