imk0tter

Recursive Kernel

Aug 22nd, 2025 (edited)
337
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void handle_open_port(unsigned int x);
  4. void handle_close_port(unsigned int x);
  5.  
  6. long previous_variable = 0;
  7.  
  8. void kernel_recursion(unsigned int x) {
  9.   unsigned int previous_x = *(unsigned int *)(previous_variable);
  10.   previous_variable = (long)(char *)&x;
  11.  
  12.   if (x < previous_x) {
  13.     handle_open_port(x); ++x;
  14.     kernel_recursion(previous_x);--x;
  15.     handle_close_port(x);
  16.   } else if (previous_x < x) {
  17.     handle_open_port(previous_x);
  18.     kernel_recursion(previous_x + 1); --x;
  19.     handle_close_port(previous_x);
  20.   } else {
  21.     handle_open_port(previous_x);
  22.     handle_close_port(previous_x);
  23.   }
  24. }
  25. void kernel(unsigned int x) {
  26.   previous_variable = (long)&x;
  27.   kernel_recursion(0);
  28. }
  29.  
  30. int main() { kernel(1337); }
  31.  
  32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
  33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
Advertisement
Comments
  • imk0tter
    1 year (edited)
    # C++ 0.94 KB | 0 0
    1. #include <stdio.h>
    2.  
    3. void handle_open_port(unsigned int x);
    4. void handle_close_port(unsigned int x);
    5.  
    6. long previous_x = 0;
    7.  
    8. void kernel_recursion(unsigned int x) {
    9.   unsigned int current_previous_x = *(unsigned int *)(previous_x);
    10.   previous_x = (long)(char *)&x;
    11.  
    12.   if (x < current_previous_x) {
    13.     handle_open_port(x); ++x;
    14.     kernel_recursion(current_previous_x);--x;
    15.     handle_close_port(x);
    16.   } else if (current_previous_x < x) {
    17.     handle_open_port(current_previous_x);
    18.     kernel_recursion(current_previous_x + 1); --x;
    19.     handle_close_port(current_previous_x);
    20.   } else {
    21.     handle_open_port(current_previous_x);
    22.     handle_close_port(current_previous_x);
    23.   }
    24. }
    25. void kernel(unsigned int x) {
    26.   previous_x = (long)&x;
    27.   kernel_recursion(0);
    28. }
    29.  
    30. int main() { kernel(10); }
    31.  
    32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
    33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
  • imk0tter
    1 year (edited)
    # C++ 1.03 KB | 0 0
    1. #include <stdio.h>
    2.  
    3. void handle_open_port(unsigned int x);
    4. void handle_close_port(unsigned int x);
    5.  
    6. long previous_x = 0;
    7.  
    8. void kernel_recursion(unsigned int x) {
    9.   unsigned int current_previous_x = *(unsigned int *)(previous_x);
    10.   //printf("PREVIOUS_X: %u ADDRESS: %ld CURRENT_ADDRESS: %ld\n", current_previous_x, previous_x, (long)&x);
    11.   previous_x = (long)&x;
    12.   if (x < current_previous_x) {
    13.     handle_open_port(x); ++x;
    14.     kernel_recursion(current_previous_x);--x;
    15.     handle_close_port(x);
    16.   } else if (current_previous_x < x) {
    17.     handle_open_port(current_previous_x);
    18.     kernel_recursion(current_previous_x + 1); --x;
    19.     handle_close_port(current_previous_x);
    20.   } else {
    21.     handle_open_port(current_previous_x);
    22.     handle_close_port(current_previous_x);
    23.   }
    24. }
    25. void kernel(unsigned int x) {
    26.   previous_x = (long)&x;
    27.   kernel_recursion(0);
    28. }
    29.  
    30. int main() { kernel(10); }
    31.  
    32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
    33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
  • imk0tter
    1 year
    # C++ 1.06 KB | 0 0
    1. #include <stdio.h>
    2.  
    3. void handle_open_port(unsigned int x);
    4. void handle_close_port(unsigned int x);
    5.  
    6. unsigned long previous_x = 0;
    7.  
    8. void kernel_recursion(unsigned int x) {
    9.   unsigned int current_previous_x = *(unsigned int *)(previous_x);
    10.   //printf("PREVIOUS_X: %u ADDRESS: %ld CURRENT_ADDRESS: %ld\n", current_previous_x, previous_x, (long)&x);
    11.   previous_x = (unsigned long)&x;
    12.   if (x < current_previous_x) {
    13.     handle_open_port(x); ++x;
    14.     kernel_recursion(current_previous_x);--x;
    15.     handle_close_port(x);
    16.   } else if (current_previous_x < x) {
    17.     handle_open_port(current_previous_x);
    18.     kernel_recursion(current_previous_x + 1); --x;
    19.     handle_close_port(current_previous_x);
    20.   } else {
    21.     handle_open_port(current_previous_x);
    22.     handle_close_port(current_previous_x);
    23.   }
    24. }
    25. void kernel(unsigned int x) {
    26.   previous_x = (unsigned long)&x;
    27.   kernel_recursion(0);
    28. }
    29.  
    30. int main() { kernel(10); }
    31.  
    32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
    33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
  • imk0tter
    1 year
    # C++ 1.08 KB | 0 0
    1. #include <stdio.h>
    2.  
    3. void handle_open_port(unsigned int x);
    4. void handle_close_port(unsigned int x);
    5.  
    6. unsigned long previous_x = 0;
    7.  
    8. void kernel_recursion(unsigned int x) {
    9.   unsigned int current_previous_x = *(unsigned int *)((unsigned long)previous_x);
    10.   //printf("PREVIOUS_X: %u ADDRESS: %ld CURRENT_ADDRESS: %ld\n", current_previous_x, previous_x, (long)&x);
    11.   previous_x = (unsigned long)&x;
    12.   if (x < current_previous_x) {
    13.     handle_open_port(x); ++x;
    14.     kernel_recursion(current_previous_x);--x;
    15.     handle_close_port(x);
    16.   } else if (current_previous_x < x) {
    17.     handle_open_port(current_previous_x);
    18.     kernel_recursion(current_previous_x + 1); --x;
    19.     handle_close_port(current_previous_x);
    20.   } else {
    21.     handle_open_port(current_previous_x);
    22.     handle_close_port(current_previous_x);
    23.   }
    24. }
    25. void kernel(unsigned int x) {
    26.   previous_x = (unsigned long)&x;
    27.   kernel_recursion(0);
    28. }
    29.  
    30. int main() { kernel(10); }
    31.  
    32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
    33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
  • imk0tter
    1 year
    # C++ 1.07 KB | 0 0
    1. #include <stdio.h>
    2.  
    3. void handle_open_port(unsigned int x);
    4. void handle_close_port(unsigned int x);
    5.  
    6. unsigned long previous_x = 0;
    7.  
    8. void kernel_recursion(unsigned int x) {
    9.   unsigned int current_previous_x = *(unsigned int *)(unsigned long)previous_x;
    10.   //printf("PREVIOUS_X: %u ADDRESS: %ld CURRENT_ADDRESS: %ld\n", current_previous_x, previous_x, (long)&x);
    11.   previous_x = (unsigned long)&x;
    12.   if (x < current_previous_x) {
    13.     handle_open_port(x); ++x;
    14.     kernel_recursion(current_previous_x);--x;
    15.     handle_close_port(x);
    16.   } else if (current_previous_x < x) {
    17.     handle_open_port(current_previous_x);
    18.     kernel_recursion(current_previous_x + 1); --x;
    19.     handle_close_port(current_previous_x);
    20.   } else {
    21.     handle_open_port(current_previous_x);
    22.     handle_close_port(current_previous_x);
    23.   }
    24. }
    25. void kernel(unsigned int x) {
    26.   previous_x = (unsigned long)&x;
    27.   kernel_recursion(0);
    28. }
    29.  
    30. int main() { kernel(10); }
    31.  
    32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
    33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
  • imk0tter
    1 year
    # C++ 1.03 KB | 0 0
    1. #include <stdio.h>
    2.  
    3. void handle_open_port(unsigned int x);
    4. void handle_close_port(unsigned int x);
    5.  
    6. long previous_x = 0;
    7.  
    8. void kernel_recursion(unsigned int x) {
    9.   unsigned int current_previous_x = *(unsigned int *)previous_x;
    10.   //printf("PREVIOUS_X: %u ADDRESS: %ld CURRENT_ADDRESS: %ld\n", current_previous_x, previous_x, (long)&x);
    11.   previous_x = (long)&x;
    12.   if (x < current_previous_x) {
    13.     handle_open_port(x); ++x;
    14.     kernel_recursion(current_previous_x);--x;
    15.     handle_close_port(x);
    16.   } else if (current_previous_x < x) {
    17.     handle_open_port(current_previous_x);
    18.     kernel_recursion(current_previous_x + 1); --x;
    19.     handle_close_port(current_previous_x);
    20.   } else {
    21.     handle_open_port(current_previous_x);
    22.     handle_close_port(current_previous_x);
    23.   }
    24. }
    25. void kernel(unsigned int x) {
    26.   previous_x = (long)&x;
    27.   kernel_recursion(0);
    28. }
    29.  
    30. int main() { kernel(10); }
    31.  
    32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
    33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
  • imk0tter
    1 year
    4
    # C++ 1.01 KB | 0 0
    1. #include <stdio.h>
    2.  
    3. void handle_open_port(unsigned int x);
    4. void handle_close_port(unsigned int x);
    5.  
    6. unsigned int * previous_x = 0;
    7.  
    8. void kernel_recursion(unsigned int x) {
    9.   unsigned int current_previous_x = *previous_x;
    10.   //printf("PREVIOUS_X: %u ADDRESS: %ld CURRENT_ADDRESS: %ld\n", current_previous_x, previous_x, (long)&x);
    11.   previous_x = &x;
    12.   if (x < current_previous_x) {
    13.     handle_open_port(x); ++x;
    14.     kernel_recursion(current_previous_x);--x;
    15.     handle_close_port(x);
    16.   } else if (current_previous_x < x) {
    17.     handle_open_port(current_previous_x);
    18.     kernel_recursion(current_previous_x + 1); --x;
    19.     handle_close_port(current_previous_x);
    20.   } else {
    21.     handle_open_port(current_previous_x);
    22.     handle_close_port(current_previous_x);
    23.   }
    24. }
    25. void kernel(unsigned int x) {
    26.   previous_x = &x;
    27.   kernel_recursion(0);
    28. }
    29.  
    30. int main() { kernel(10); }
    31.  
    32. void handle_open_port(unsigned int x) { printf("OPENING: %u\n", x); }
    33. void handle_close_port(unsigned int x) { printf("CLOSING: %u\n", x); }
Add Comment
Please, Sign In to add comment