#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int main(void) {
  printf("Only run this program if you can reboot the computer that you are "
         "running it on. Preferably run it on your own computer---not a "
         "computer administered by someone else.\n\n");
  printf(
      "Even if running 'limit' on the command line shows a cap on the maximum "
      "number of processes you can run, a fork bomb may make it difficult for "
      "you to run other processes (such as 'killall') to kill the process.\n");
  printf("\n");
  printf("You have been warned.\n");
  printf("\n");
  printf(
      "Press Ctrl+C if you don't want to run a fork bomb on this machine.\n");
  printf("Press any other key to (probably) crash this machine.\n");
  char buf[100];
  fgets(buf, 100, stdin);
  while (1)
    fork();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xf57(%rip),%rdi
call   1030 <printf@plt>
lea    0xf49(%rip),%rdi
call   1030 <printf@plt>
lea    0x1012(%rip),%rdi
call   1030 <printf@plt>
lea    0xf31(%rip),%rdi
call   1030 <printf@plt>
lea    0x1011(%rip),%rdi
call   1030 <printf@plt>
lea    0x1049(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2e4a(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1040 <fgets@plt>
mov    $0x0,%al
call   1050 <fork@plt>
jmp    11aa <main+0x7a>

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xf51(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x100d(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x100d(%rip),%rdi
call   1040 <puts@plt>
lea    0x1044(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <fork@plt>
jmp    11b0 <main+0x70>

LLVM IR (-O0):
@.str = [169 x i8] c"Only run this program if you can reboot the computer that you are running it on. Preferably run it on your own computer---not a computer administered by someone else.\0A\0A\00"
@.str.1 = [211 x i8] c"Even if running 'limit' on the command line shows a cap on the maximum number of processes you can run, a fork bomb may make it difficult for you to run other processes (such as 'killall') to kill the process.\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [23 x i8] c"You have been warned.\0A\00"
@.str.4 = [68 x i8] c"Press Ctrl+C if you don't want to run a fork bomb on this machine.\0A\00"
@.str.5 = [55 x i8] c"Press any other key to (probably) crash this machine.\0A\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([211 x i8], [211 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 100, i32 %11)
br label %13
13: ; preds = %0, %13
%14 = call i32 (...) @fork()
br label %13
}

LLVM IR (-O2):
@stdin = global i32 0
@str = [168 x i8] c"Only run this program if you can reboot the computer that you are running it on. Preferably run it on your own computer---not a computer administered by someone else.\0A\00"
@str.6 = [210 x i8] c"Even if running 'limit' on the command line shows a cap on the maximum number of processes you can run, a fork bomb may make it difficult for you to run other processes (such as 'killall') to kill the process.\00"
@str.7 = [22 x i8] c"You have been warned.\00"
@str.8 = [67 x i8] c"Press Ctrl+C if you don't want to run a fork bomb on this machine.\00"
@str.9 = [54 x i8] c"Press any other key to (probably) crash this machine.\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([168 x i8], [168 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([210 x i8], [210 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.8, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.9, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 100, i32 %10)
br label %12
12: ; preds = %12, %0
%13 = call i32 (...) @fork()
br label %12
}