void kmain(int magic, void *mboot) {
  ((void)((magic == 0x2BADB002)
              ? 0
              : panic("Assertion failed: "
                      "magic == 0x2BADB002",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/Mihail-K/"
                      "Sptifire-Kernel/refs/heads/master/kmain.c",
                      10)));
  kprintf("Loading GDT.\n");
  gdtInstall();
  kprintf("Loading IDT.\n");
  idtInstall();
  __asm__("int $2");
  kprintf("Done.\n");
  ((void)mboot);
  hang();
}


x86 assembly (clang, -O0):
<kmain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2badb002,-0x4(%rbp)
jne    1171 <kmain+0x21>
jmp    118b <kmain+0x3b>
lea    0xe88(%rip),%rdi
lea    0xea7(%rip),%rsi
mov    $0xa,%edx
mov    $0x0,%al
call   1050 <panic@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1070 <kprintf@plt>
mov    $0x0,%al
call   1040 <gdtInstall@plt>
lea    0xf1a(%rip),%rdi
mov    $0x0,%al
call   1070 <kprintf@plt>
mov    $0x0,%al
call   1030 <idtInstall@plt>
int    $0x2
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1070 <kprintf@plt>
mov    $0x0,%al
call   1060 <hang@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmain>:
push   %rax
cmp    $0x2badb002,%edi
je     1173 <kmain+0x23>
lea    0xea0(%rip),%rdi
lea    0xebf(%rip),%rsi
mov    $0xa,%edx
xor    %eax,%eax
call   1050 <panic@plt>
lea    0xf39(%rip),%rdi
xor    %eax,%eax
call   1070 <kprintf@plt>
xor    %eax,%eax
call   1040 <gdtInstall@plt>
lea    0xf32(%rip),%rdi
xor    %eax,%eax
call   1070 <kprintf@plt>
xor    %eax,%eax
call   1030 <idtInstall@plt>
int    $0x2
lea    0xf29(%rip),%rdi
xor    %eax,%eax
call   1070 <kprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <hang@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Assertion failed: magic == 0x2BADB002\00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Mihail-K/Sptifire-Kernel/refs/heads/master/kmain.c\00"
@.str.2 = [14 x i8] c"Loading GDT.\0A\00"
@.str.3 = [14 x i8] c"Loading IDT.\0A\00"
@.str.4 = [7 x i8] c"Done.\0A\00"
define void @kmain(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 732803074
br i1 %6, label %7, label %8
7: ; preds = %2
br label %10
8: ; preds = %2
%9 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @panic to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 10)
br label %10
10: ; preds = %8, %7
%11 = phi i32 [ 0, %7 ], [ %9, %8 ]
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (...) @gdtInstall()
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (...) @idtInstall()
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%17 = load i8*, i8** %4
%18 = call i32 (...) @hang()
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Assertion failed: magic == 0x2BADB002\00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Mihail-K/Sptifire-Kernel/refs/heads/master/kmain.c\00"
@.str.2 = [14 x i8] c"Loading GDT.\0A\00"
@.str.3 = [14 x i8] c"Loading IDT.\0A\00"
@.str.4 = [7 x i8] c"Done.\0A\00"
define void @kmain(i32 %0, i8* nocapture readnone %1) {
%3 = icmp eq i32 %0, 732803074
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @panic to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 10)
br label %6
6: ; preds = %2, %4
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @gdtInstall()
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 (...) @idtInstall()
tail call void asm sideeffect "int $$2", "~{dirflag},~{fpsr},~{flags}"()
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 (...) @hang()
ret void
}