#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 get_random_number(int);
int /*<<< orphan*/ printstr(char *);
int /*<<< orphan*/ send_signal(int, int);
int /*<<< orphan*/ sleep(int);
void rocket_launcher(int pid) {
  printstr("You're very aggressive, right?\n");
  sleep(2);
  printstr("PSSSSBAAAAAAAMMMMMM\n");
  sleep(2);
  send_signal(pid, 15);
  if (get_random_number(10) < 7) {
    send_signal(pid + 1, 15);
  }
  if (get_random_number(9) < 7) {
    send_signal(pid - 1, 15);
  }
}


x86 assembly (clang, -O0):
<rocket_launcher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeae(%rip),%rdi
call   1030 <printstr@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
lea    0xeb8(%rip),%rdi
call   1030 <printstr@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
mov    -0x4(%rbp),%edi
mov    $0xf,%esi
call   1040 <send_signal@plt>
mov    $0xa,%edi
call   1050 <get_random_number@plt>
cmp    $0x7,%eax
jge    11a7 <rocket_launcher+0x67>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    $0xf,%esi
call   1040 <send_signal@plt>
mov    $0x9,%edi
call   1050 <get_random_number@plt>
cmp    $0x7,%eax
jge    11ca <rocket_launcher+0x8a>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    $0xf,%esi
call   1040 <send_signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rocket_launcher>:
push   %rbx
mov    %edi,%ebx
lea    0xeb6(%rip),%rdi
call   1030 <printstr@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
lea    0xec0(%rip),%rdi
call   1030 <printstr@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
mov    %ebx,%edi
mov    $0xf,%esi
call   1040 <send_signal@plt>
mov    $0xa,%edi
call   1050 <get_random_number@plt>
cmp    $0x6,%eax
jg     1197 <rocket_launcher+0x57>
lea    0x1(%rbx),%edi
mov    $0xf,%esi
call   1040 <send_signal@plt>
mov    $0x9,%edi
call   1050 <get_random_number@plt>
cmp    $0x6,%eax
jg     11b6 <rocket_launcher+0x76>
add    $0xffffffff,%ebx
mov    %ebx,%edi
mov    $0xf,%esi
pop    %rbx
jmp    1040 <send_signal@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"You're very aggressive, right?\0A\00"
@.str.1 = [21 x i8] c"PSSSSBAAAAAAAMMMMMM\0A\00"
define void @rocket_launcher(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printstr(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 2)
%5 = call i32 @printstr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @sleep(i32 2)
%7 = load i32, i32* %2
%8 = call i32 @send_signal(i32 %7, i32 15)
%9 = call i32 @get_random_number(i32 10)
%10 = icmp slt i32 %9, 7
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
%14 = call i32 @send_signal(i32 %13, i32 15)
br label %15
15: ; preds = %11, %1
%16 = call i32 @get_random_number(i32 9)
%17 = icmp slt i32 %16, 7
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, 1
%21 = call i32 @send_signal(i32 %20, i32 15)
br label %22
22: ; preds = %18, %15
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"You're very aggressive, right?\0A\00"
@.str.1 = [21 x i8] c"PSSSSBAAAAAAAMMMMMM\0A\00"
define void @rocket_launcher(i32 %0) {
%2 = tail call i32 @printstr(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 2)
%4 = tail call i32 @printstr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 2)
%6 = tail call i32 @send_signal(i32 %0, i32 15)
%7 = tail call i32 @get_random_number(i32 10)
%8 = icmp slt i32 %7, 7
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = add nsw i32 %0, 1
%11 = tail call i32 @send_signal(i32 %10, i32 15)
br label %12
12: ; preds = %9, %1
%13 = tail call i32 @get_random_number(i32 9)
%14 = icmp slt i32 %13, 7
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = add nsw i32 %0, -1
%17 = tail call i32 @send_signal(i32 %16, i32 15)
br label %18
18: ; preds = %15, %12
ret void
}