#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*/ nand_read(int, unsigned char *, int);
int /*<<< orphan*/ setup_commandline_tags(char *);
int /*<<< orphan*/ setup_end_tag();
int /*<<< orphan*/ setup_memory_tags();
int /*<<< orphan*/ setup_start_teg();
int /*<<< orphan*/ uart_init();
int main(void) {
  void (*theKernel)(int zero, int arch, unsigned int params);
  uart_init();
  nand_read(0x60000 + 64, (unsigned char *)0x30008000, 0x200000);
  setup_start_teg();
  setup_memory_tags();
  setup_commandline_tags(
      "noinitrd root=/dev/nfs "
      "nfsroot=192.168.1.110:/home/book/student/nfs_root/first_fs "
      "ip=192.168.1.11:192.168.1.110:192.168.1.1:255.255.255.0::eth0:off "
      "init=/linuxrc console=ttySAC0");
  setup_end_tag();
  theKernel = (void (*)(int, int, unsigned int))0x30008000;
  theKernel(0, 362, 0x30000100);
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <uart_init@plt>
mov    $0x60040,%edi
mov    $0x30008000,%esi
mov    $0x200000,%edx
call   1080 <nand_read@plt>
mov    $0x0,%al
call   1060 <setup_start_teg@plt>
mov    $0x0,%al
call   1050 <setup_memory_tags@plt>
lea    0xe61(%rip),%rdi
call   1030 <setup_commandline_tags@plt>
mov    $0x0,%al
call   1070 <setup_end_tag@plt>
mov    $0x30008000,%eax
mov    %rax,-0x10(%rbp)
xor    %edi,%edi
mov    $0x16a,%esi
mov    $0x30000100,%edx
call   *-0x10(%rbp)
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <uart_init@plt>
mov    $0x30008000,%ebx
mov    $0x30008000,%esi
mov    $0x60040,%edi
mov    $0x200000,%edx
call   1080 <nand_read@plt>
xor    %eax,%eax
call   1060 <setup_start_teg@plt>
xor    %eax,%eax
call   1050 <setup_memory_tags@plt>
lea    0xe6a(%rip),%rdi
call   1030 <setup_commandline_tags@plt>
xor    %eax,%eax
call   1070 <setup_end_tag@plt>
xor    %edi,%edi
mov    $0x16a,%esi
mov    $0x30000100,%edx
call   *%rbx
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [178 x i8] c"noinitrd root=/dev/nfs nfsroot=192.168.1.110:/home/book/student/nfs_root/first_fs ip=192.168.1.11:192.168.1.110:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca void (i32, i32, i32)*
store i32 0, i32* %1
%3 = call i32 (...) @uart_init()
%4 = call i32 @nand_read(i32 393280, i8* inttoptr (i64 805339136 to i8*), i32 2097152)
%5 = call i32 (...) @setup_start_teg()
%6 = call i32 (...) @setup_memory_tags()
%7 = call i32 @setup_commandline_tags(i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @setup_end_tag()
store void (i32, i32, i32)* inttoptr (i64 805339136 to void (i32, i32, i32)*), void (i32, i32, i32)** %2
%9 = load void (i32, i32, i32)*, void (i32, i32, i32)** %2
ret i32 -1
}

LLVM IR (-O2):
@.str = [178 x i8] c"noinitrd root=/dev/nfs nfsroot=192.168.1.110:/home/book/student/nfs_root/first_fs ip=192.168.1.11:192.168.1.110:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0\00"
define i32 @main() {
%1 = tail call i32 (...) @uart_init()
%2 = tail call i32 @nand_read(i32 393280, i8* inttoptr (i64 805339136 to i8*), i32 2097152)
%3 = tail call i32 (...) @setup_start_teg()
%4 = tail call i32 (...) @setup_memory_tags()
%5 = tail call i32 @setup_commandline_tags(i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @setup_end_tag()
tail call void inttoptr (i64 805339136 to void (i32, i32, i32)*)(i32 0, i32 362, i32 805306624)
ret i32 -1
}