#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;
int /*<<< orphan*/ errno;
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
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", strerror(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    11e6 <hog_other_cpus+0xa6>
xor    %eax,%eax
call   1060 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0xffffffff,%eax
je     118d <hog_other_cpus+0x4d>
jmp    1173 <hog_other_cpus+0x33>
mov    -0x8(%rbp),%eax
test   %eax,%eax
jne    11ce <hog_other_cpus+0x8e>
jmp    1183 <hog_other_cpus+0x43>
jmp    1188 <hog_other_cpus+0x48>
jmp    1188 <hog_other_cpus+0x48>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0xe4c(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1040 <kill@plt>
jmp    11d3 <hog_other_cpus+0x93>
jmp    11d3 <hog_other_cpus+0x93>
jmp    11d8 <hog_other_cpus+0x98>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    114f <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"
@errno = global i32 0
@SIGTERM = global i32 0
define i32 @hog_other_cpus() {
%1 = alloca i32
store i32 1, i32* %1
br label %2
2: ; preds = %18, %0
%3 = load i32, i32* %1
%4 = icmp ugt i32 %3, 1
br i1 %4, label %5, label %21
5: ; preds = %2
%6 = call i32 (...) @fork()
switch i32 %6, label %16 [
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 i32, i32* @errno
%12 = call i8* @strerror(i32 %11)
%13 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @SIGTERM
%15 = call i32 @kill(i32 0, i32 %14)
br label %17
16: ; preds = %5
br label %17
17: ; preds = %16, %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %1
%20 = add i32 %19, -1
store i32 %20, i32* %1
br label %2
21: ; preds = %2
ret i32 0
}

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