#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 */
typedef scalar_t__ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strlen(char *);
scalar_t__ write(int, char *, int /*<<< orphan*/);
void enable_kernel_bpf_jit_compiler(void) {
  int fd;
  ssize_t ret;
  char *file = "/proc/sys/net/core/bpf_jit_enable";
  fd = open(file, O_WRONLY);
  if (fd < 0)
    return;
  ret = write(fd, "1", strlen("1"));
  if (ret > 0)
    printf("BPF JIT\n");
  close(fd);
}


x86 assembly (clang, -O0):
<enable_kernel_bpf_jit_compiler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1187 <enable_kernel_bpf_jit_compiler+0x37>
jmp    11cd <enable_kernel_bpf_jit_compiler+0x7d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xe8e(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%edx
lea    0xe7d(%rip),%rsi
call   1030 <write@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    11c5 <enable_kernel_bpf_jit_compiler+0x75>
lea    0xe64(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_kernel_bpf_jit_compiler>:
push   %r14
push   %rbx
push   %rax
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
lea    0xe9c(%rip),%rdi
call   1070 <open@plt>
test   %eax,%eax
js     11a9 <enable_kernel_bpf_jit_compiler+0x59>
mov    %eax,%ebx
lea    0xeac(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %rax,%rax
jle    119b <enable_kernel_bpf_jit_compiler+0x4b>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <close@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [34 x i8] c"/proc/sys/net/core/bpf_jit_enable\00"
@O_WRONLY = global i32 0
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [9 x i8] c"BPF JIT\0A\00"
define void @enable_kernel_bpf_jit_compiler() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8*
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = load i32, i32* @O_WRONLY
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %0
br label %21
10: ; preds = %0
%11 = load i32, i32* %1
%12 = call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = call i64 @write(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i64 %13, i64* %2
%14 = load i64, i64* %2
%15 = icmp sgt i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %10
%19 = load i32, i32* %1
%20 = call i32 @close(i32 %19)
br label %21
21: ; preds = %18, %9
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"/proc/sys/net/core/bpf_jit_enable\00"
@O_WRONLY = global i32 0
@.str.1 = [2 x i8] c"1\00"
@str = [8 x i8] c"BPF JIT\00"
define void @enable_kernel_bpf_jit_compiler() {
%1 = load i32, i32* @O_WRONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp slt i32 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %0
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i64 @write(i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
%11 = tail call i32 @close(i32 %2)
br label %12
12: ; preds = %0, %10
ret void
}