#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 check_load();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sys_log(char *);
int /*<<< orphan*/ system(char *);
main() {
  printf("**********************************\n");
  printf("load_daemon : start\n");
  printf("**********************************\n");
  while (1) {
    sleep(60);
    if (check_load() == 1) {
      printf("check_load : loadavg alert!!!!!!\n");
      sys_log("enter in sleep mode, killall udp_get&mydns!\n");
      system("killall udp_get");
      sleep(2);
      system("killall mydns");
      sleep(2);
      system("service apache2 stop");
      sleep(2);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3c,%edi
call   1070 <sleep@plt>
mov    $0x0,%al
call   1050 <check_load@plt>
cmp    $0x1,%eax
jne    11f7 <main+0xa7>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1060 <sys_log@plt>
lea    0xecc(%rip),%rdi
call   1030 <system@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
lea    0xec6(%rip),%rdi
call   1030 <system@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
lea    0xebe(%rip),%rdi
call   1030 <system@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
jmp    1183 <main+0x33>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xf14(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf14(%rip),%r14
lea    0xe76(%rip),%r15
lea    0xe9c(%rip),%r12
lea    0xea5(%rip),%r13
lea    0xeac(%rip),%rbx
nop
mov    $0x3c,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
call   1050 <check_load@plt>
cmp    $0x1,%eax
jne    11a0 <main+0x50>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1060 <sys_log@plt>
mov    %r12,%rdi
call   1040 <system@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
mov    %r13,%rdi
call   1040 <system@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
jmp    11a0 <main+0x50>

LLVM IR (-O0):
@.str = [36 x i8] c"**********************************\0A\00"
@.str.1 = [21 x i8] c"load_daemon : start\0A\00"
@.str.2 = [34 x i8] c"check_load : loadavg alert!!!!!!\0A\00"
@.str.3 = [45 x i8] c"enter in sleep mode, killall udp_get&mydns!\0A\00"
@.str.4 = [16 x i8] c"killall udp_get\00"
@.str.5 = [14 x i8] c"killall mydns\00"
@.str.6 = [21 x i8] c"service apache2 stop\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %18
%6 = call i32 @sleep(i32 60)
%7 = call i32 (...) @check_load()
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @sys_log(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @sleep(i32 2)
%14 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @sleep(i32 2)
%16 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @sleep(i32 2)
br label %18
18: ; preds = %9, %5
br label %5
}

LLVM IR (-O2):
@.str.3 = [45 x i8] c"enter in sleep mode, killall udp_get&mydns!\0A\00"
@.str.4 = [16 x i8] c"killall udp_get\00"
@.str.5 = [14 x i8] c"killall mydns\00"
@.str.6 = [21 x i8] c"service apache2 stop\00"
@str.7 = [20 x i8] c"load_daemon : start\00"
@str.8 = [35 x i8] c"**********************************\00"
@str.9 = [33 x i8] c"check_load : loadavg alert!!!!!!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
br label %4
4: ; preds = %17, %0
%5 = tail call i32 @sleep(i32 60)
%6 = tail call i32 (...) @check_load()
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.9, i64 0, i64 0))
%10 = tail call i32 @sys_log(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @sleep(i32 2)
%13 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%14 = tail call i32 @sleep(i32 2)
%15 = tail call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%16 = tail call i32 @sleep(i32 2)
br label %17
17: ; preds = %8, %4
br label %4
}