#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*/ SIGTERM;
size_t errno;
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char **sys_errlist;
unsigned int hog_other_cpus() {
  unsigned int count;
  for (count = 1; count > 1; --count) {
    switch (fork()) {
    case 0:
      while (1)
        ;
      break;
    case -1:
      fprintf(stderr, "Error forking\t%s\n", sys_errlist[errno]);
      kill(0, SIGTERM);
      break;
    default:
      break;
    }
  }
  return 1 - 1;
}


x86 assembly (clang, -O0):
<hog_other_cpus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jbe    11d7 <hog_other_cpus+0xa7>
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0xffffffff,%eax
je     117d <hog_other_cpus+0x4d>
jmp    1163 <hog_other_cpus+0x33>
mov    -0x8(%rbp),%eax
test   %eax,%eax
jne    11bf <hog_other_cpus+0x8f>
jmp    1173 <hog_other_cpus+0x43>
jmp    1178 <hog_other_cpus+0x48>
jmp    1178 <hog_other_cpus+0x48>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    0x2e6b(%rip),%rax
mov    (%rax),%rax
mov    0x2e31(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe5b(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1040 <kill@plt>
jmp    11c4 <hog_other_cpus+0x94>
jmp    11c4 <hog_other_cpus+0x94>
jmp    11c9 <hog_other_cpus+0x99>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <hog_other_cpus+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hog_other_cpus>:
xor    %eax,%eax
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Error forking\09%s\0A\00"
@sys_errlist = global i8** null
@errno = global i64 0
@SIGTERM = global i32 0
define i32 @hog_other_cpus() {
%1 = alloca i32
store i32 1, i32* %1
br label %2
2: ; preds = %20, %0
%3 = load i32, i32* %1
%4 = icmp ugt i32 %3, 1
br i1 %4, label %5, label %23
5: ; preds = %2
%6 = call i32 (...) @fork()
switch i32 %6, label %18 [
i32 0, label %7
i32 -1, label %9
]
7: ; preds = %5
br label %8
8: ; preds = %7, %8
br label %8
9: ; preds = %5
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** @sys_errlist
%12 = load i64, i64* @errno
%13 = getelementptr inbounds i8*, i8** %11, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @SIGTERM
%17 = call i32 @kill(i32 0, i32 %16)
br label %19
18: ; preds = %5
br label %19
19: ; preds = %18, %9
br label %20
20: ; preds = %19
%21 = load i32, i32* %1
%22 = add i32 %21, -1
store i32 %22, i32* %1
br label %2
23: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@sys_errlist = global i8** null
@errno = global i64 0
@SIGTERM = global i32 0
define i32 @hog_other_cpus() {
ret i32 0
}