#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 vas {
  int dummy;
};

/* Variables and functions */
scalar_t__ _assert_fail(char *, int, char *);
struct vas *vm_get_current_vas();
void ensure_kernel_vas() {
  {
    if ((vm_get_current_vas() == ((struct vas *)0xf0200000) &&
         "Must run in kernel VAS!") ||
        _assert_fail("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/rrk22/course_os/refs/"
                     "heads/master/kernel/vm.h",
                     180,
                     "vm_get_current_vas() == KERNEL_VAS && \"Must run in "
                     "kernel VAS!\""))
      ;
  };
}


x86 assembly (clang, -O0):
<ensure_kernel_vas>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <vm_get_current_vas@plt>
mov    $0xf0200000,%ecx
cmp    %rcx,%rax
jne    1148 <ensure_kernel_vas+0x28>
mov    $0x1,%al
test   $0x1,%al
jne    116a <ensure_kernel_vas+0x4a>
jmp    1148 <ensure_kernel_vas+0x28>
lea    0xec9(%rip),%rdi
mov    $0xb4,%esi
lea    0xf45(%rip),%rdx
call   1030 <_assert_fail@plt>
cmp    $0x0,%rax
je     116f <ensure_kernel_vas+0x4f>
jmp    116f <ensure_kernel_vas+0x4f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure_kernel_vas>:
push   %rax
xor    %eax,%eax
call   1040 <vm_get_current_vas@plt>
mov    $0xf0200000,%ecx
cmp    %rcx,%rax
je     114b <ensure_kernel_vas+0x2b>
lea    0xec7(%rip),%rdi
lea    0xf48(%rip),%rdx
mov    $0xb4,%esi
pop    %rax
jmp    1030 <_assert_fail@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.vas = type { i32 }
@.str = [24 x i8] c"Must run in kernel VAS!\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rrk22/course_os/refs/heads/master/kernel/vm.h\00"
@.str.2 = [64 x i8] c"vm_get_current_vas() == KERNEL_VAS && \22Must run in kernel VAS!\22\00"
define void @ensure_kernel_vas() {
%1 = call %struct.vas* (...) @vm_get_current_vas()
%2 = icmp eq %struct.vas* %1, inttoptr (i64 4028628992 to %struct.vas*)
br i1 %2, label %3, label %4
3: ; preds = %0
br i1 true, label %7, label %4
4: ; preds = %3, %0
%5 = call i64 @_assert_fail(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 180, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4, %3
br label %8
8: ; preds = %7, %4
ret void
}

LLVM IR (-O2):
%struct.vas = type { i32 }
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rrk22/course_os/refs/heads/master/kernel/vm.h\00"
@.str.2 = [64 x i8] c"vm_get_current_vas() == KERNEL_VAS && \22Must run in kernel VAS!\22\00"
define void @ensure_kernel_vas() {
%1 = tail call %struct.vas* (...) @vm_get_current_vas()
%2 = icmp eq %struct.vas* %1, inttoptr (i64 4028628992 to %struct.vas*)
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i64 @_assert_fail(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 180, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}