#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*/ LOG_LOCAL0;
int /*<<< orphan*/ LOG_PID;
int /*<<< orphan*/ banner();
int /*<<< orphan*/ bye();
int /*<<< orphan*/ chdir(char *);
scalar_t__ do_command(int /*<<< orphan*/);
int /*<<< orphan*/ execpop();
double getload();
int getpid();
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ stdin;
int time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  double load = getload();
  chdir("/tmp");
  openlog("fakepop", LOG_PID, LOG_LOCAL0);
  if (load < 20.0) {
    execpop();
  }
  srand(getpid() ^ time(NULL));
  banner();
  while (do_command(stdin))
    ;
  bye();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getload@plt>
movsd  %xmm0,-0x18(%rbp)
lea    0xe3f(%rip),%rdi
call   1070 <chdir@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%esi
mov    0x2e0a(%rip),%rax
mov    (%rax),%edx
lea    0xe26(%rip),%rdi
call   10c0 <openlog@plt>
movsd  0xe0c(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1206 <main+0x66>
mov    $0x0,%al
call   1060 <execpop@plt>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    -0x1c(%rbp),%edi
xor    %eax,%edi
call   1090 <srand@plt>
mov    $0x0,%al
call   1080 <banner@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
call   1040 <do_command@plt>
cmp    $0x0,%rax
je     1247 <main+0xa7>
jmp    122a <main+0x8a>
mov    $0x0,%al
call   10b0 <bye@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <getload@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xe4f(%rip),%rdi
call   1070 <chdir@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%esi
mov    0x2e1a(%rip),%rax
mov    (%rax),%edx
lea    0xe36(%rip),%rdi
call   10c0 <openlog@plt>
movsd  0xe1c(%rip),%xmm0
ucomisd 0x8(%rsp),%xmm0
jbe    11f3 <main+0x53>
xor    %eax,%eax
call   1060 <execpop@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   10a0 <time@plt>
xor    %eax,%ebx
mov    %ebx,%edi
call   1090 <srand@plt>
xor    %eax,%eax
call   1080 <banner@plt>
mov    0x2dc6(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%edi
call   1040 <do_command@plt>
test   %rax,%rax
jne    1220 <main+0x80>
xor    %eax,%eax
call   10b0 <bye@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [8 x i8] c"fakepop\00"
@LOG_PID = global i32 0
@LOG_LOCAL0 = global i32 0
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call double (...) @getload()
store double %7, double* %6
%8 = call i32 @chdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @LOG_PID
%10 = load i32, i32* @LOG_LOCAL0
%11 = call i32 @openlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10)
%12 = load double, double* %6
%13 = fcmp olt double %12, 2.000000e+01
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (...) @execpop()
br label %16
16: ; preds = %14, %2
%17 = call i32 (...) @getpid()
%18 = call i32 @time(i32* null)
%19 = xor i32 %17, %18
%20 = call i32 @srand(i32 %19)
%21 = call i32 (...) @banner()
br label %22
22: ; preds = %26, %16
%23 = load i32, i32* @stdin
%24 = call i64 @do_command(i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
br label %22
27: ; preds = %22
%28 = call i32 (...) @bye()
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [5 x i8] c"/tmp\00"
@.str.1 = [8 x i8] c"fakepop\00"
@LOG_PID = global i32 0
@LOG_LOCAL0 = global i32 0
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double (...) @getload()
%4 = tail call i32 @chdir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @LOG_PID
%6 = load i32, i32* @LOG_LOCAL0
%7 = tail call i32 @openlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6)
%8 = fcmp olt double %3, 2.000000e+01
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @execpop()
br label %11
11: ; preds = %9, %2
%12 = tail call i32 (...) @getpid()
%13 = tail call i32 @time(i32* null)
%14 = xor i32 %13, %12
%15 = tail call i32 @srand(i32 %14)
%16 = tail call i32 (...) @banner()
br label %17
17: ; preds = %17, %11
%18 = load i32, i32* @stdin
%19 = tail call i64 @do_command(i32 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %17
21: ; preds = %17
%22 = tail call i32 (...) @bye()
ret i32 0
}