#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*/ exit(int);
int /*<<< orphan*/ print_message(char *, char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
void sigint_handler(int arg) {
  print_message("IRCP009", "Received SIGINT signal.");
  print_message("IRCP010", "Waiting for any child processes to die.");
  wait(0);
  print_message("IRCP011", "Terminating execution.");
  exit(1);
}


x86 assembly (clang, -O0):
<sigint_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1030 <print_message@plt>
lea    0xecb(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1030 <print_message@plt>
xor    %edi,%edi
call   1050 <wait@plt>
lea    0xee1(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <print_message@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sigint_handler>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1030 <print_message@plt>
lea    0xed5(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <print_message@plt>
xor    %edi,%edi
call   1050 <wait@plt>
lea    0xeeb(%rip),%rdi
lea    0xeec(%rip),%rsi
call   1030 <print_message@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"IRCP009\00"
@.str.1 = [24 x i8] c"Received SIGINT signal.\00"
@.str.2 = [8 x i8] c"IRCP010\00"
@.str.3 = [40 x i8] c"Waiting for any child processes to die.\00"
@.str.4 = [8 x i8] c"IRCP011\00"
@.str.5 = [23 x i8] c"Terminating execution.\00"
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @print_message(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @print_message(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @wait(i32 0)
%6 = call i32 @print_message(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"IRCP009\00"
@.str.1 = [24 x i8] c"Received SIGINT signal.\00"
@.str.2 = [8 x i8] c"IRCP010\00"
@.str.3 = [40 x i8] c"Waiting for any child processes to die.\00"
@.str.4 = [8 x i8] c"IRCP011\00"
@.str.5 = [23 x i8] c"Terminating execution.\00"
define void @sigint_handler(i32 %0) {
%2 = tail call i32 @print_message(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @print_message(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @wait(i32 0)
%5 = tail call i32 @print_message(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
}