#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 */
struct sysinfo {
  int *loads;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ sysinfo(struct sysinfo *);
int main(int argc, char *argv[]) {
  int lalevel;
  struct sysinfo sys_info;
  if (argc == 1)
    lalevel = 1;
  else
    lalevel = atoi(argv[1]);
  if (sysinfo(&sys_info) != 0)
    perror("sysinfo");
  if (sys_info.loads[0] > lalevel * 65536)
    return 1;
  else
    return 0;
}


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)
cmpl   $0x1,-0x8(%rbp)
jne    115c <main+0x2c>
movl   $0x1,-0x14(%rbp)
jmp    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <sysinfo@plt>
cmp    $0x0,%rax
je     118b <main+0x5b>
lea    0xe7a(%rip),%rdi
call   1030 <perror@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x14(%rbp),%ecx
shl    $0x10,%ecx
cmp    %ecx,%eax
jle    11ab <main+0x7b>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <main+0x82>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x10000,%ebx
cmp    $0x1,%edi
je     114d <main+0x1d>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
lea    0x8(%rsp),%rdi
call   1050 <sysinfo@plt>
test   %rax,%rax
jne    116e <main+0x3e>
mov    0x8(%rsp),%rcx
xor    %eax,%eax
cmp    %ebx,(%rcx)
setg   %al
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe8b(%rip),%rdi
call   1030 <perror@plt>
jmp    115c <main+0x2c>

LLVM IR (-O0):
%struct.sysinfo = type { i32* }
@.str = [8 x i8] c"sysinfo\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sysinfo
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %6
br label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
br label %16
16: ; preds = %11, %10
%17 = call i64 @sysinfo(%struct.sysinfo* %7)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %7, i32 0, i32 0
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 0
%25 = load i32, i32* %24
%26 = load i32, i32* %6
%27 = mul nsw i32 %26, 65536
%28 = icmp sgt i32 %25, %27
br i1 %28, label %29, label %30
29: ; preds = %21
store i32 1, i32* %3
br label %31
30: ; preds = %21
store i32 0, i32* %3
br label %31
31: ; preds = %30, %29
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
%struct.sysinfo = type { i32* }
@.str = [8 x i8] c"sysinfo\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sysinfo
%4 = bitcast %struct.sysinfo* %3 to i8*
%5 = icmp eq i32 %0, 1
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = shl i32 %9, 16
br label %11
11: ; preds = %2, %6
%12 = phi i32 [ %10, %6 ], [ 65536, %2 ]
%13 = call i64 @sysinfo(%struct.sysinfo* %3)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
%18 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %3, i64 0, i32 0
%19 = load i32*, i32** %18
%20 = load i32, i32* %19
%21 = icmp sgt i32 %20, %12
%22 = zext i1 %21 to i32
ret i32 %22
}