#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*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ system(char *);
int main() {
  int delay = 600;
  printf("*****************************************\n");
  printf("heart_beat_run : start\n");
  printf("period : 600 seconds!\n");
  printf("*****************************************\n");
  while (1) {
    sleep(delay - 30);
    printf("heart_beat : start\n");
    system("/ailvgo/system/box/heart_beat &");
    sleep(30);
    system("killall heart_beat");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x258,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
sub    $0x1e,%edi
mov    %edi,-0xc(%rbp)
call   1050 <sleep@plt>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1030 <system@plt>
mov    $0x1e,%edi
call   1050 <sleep@plt>
lea    0xee1(%rip),%rdi
call   1030 <system@plt>
jmp    1176 <main+0x46>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xf24(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf1f(%rip),%r14
lea    0xe8e(%rip),%r15
lea    0xea7(%rip),%rbx
nopl   0x0(%rax)
mov    $0x23a,%edi
call   1050 <sleep@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <system@plt>
mov    $0x1e,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
jmp    1180 <main+0x50>

LLVM IR (-O0):
@.str = [43 x i8] c"*****************************************\0A\00"
@.str.1 = [24 x i8] c"heart_beat_run : start\0A\00"
@.str.2 = [23 x i8] c"period : 600 seconds!\0A\00"
@.str.3 = [20 x i8] c"heart_beat : start\0A\00"
@.str.4 = [32 x i8] c"/ailvgo/system/box/heart_beat &\00"
@.str.5 = [19 x i8] c"killall heart_beat\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 600, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %0, %7
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 30
%10 = call i32 @sleep(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @sleep(i32 30)
%14 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %7
}

LLVM IR (-O2):
@.str.4 = [32 x i8] c"/ailvgo/system/box/heart_beat &\00"
@.str.5 = [19 x i8] c"killall heart_beat\00"
@str.6 = [23 x i8] c"heart_beat_run : start\00"
@str.7 = [22 x i8] c"period : 600 seconds!\00"
@str.8 = [42 x i8] c"*****************************************\00"
@str.9 = [19 x i8] c"heart_beat : start\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.8, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.8, i64 0, i64 0))
br label %5
5: ; preds = %5, %0
%6 = tail call i32 @sleep(i32 570)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @sleep(i32 30)
%10 = tail call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %5
}