#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_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ pqos_fini();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stop_monitoring();
void __attribute__((noreturn)) monitoring_ctrlc(int signo) {
  printf("\nExiting[%d]...\n", signo);
  stop_monitoring();
  if (pqos_fini() != 0) {
    printf("Error shutting down PQoS library!\n");
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<monitoring_ctrlc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <stop_monitoring@plt>
mov    $0x0,%al
call   1040 <pqos_fini@plt>
cmp    $0x0,%rax
je     1190 <monitoring_ctrlc+0x50>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<monitoring_ctrlc>:
push   %rax
mov    %edi,%esi
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <stop_monitoring@plt>
xor    %eax,%eax
call   1050 <pqos_fini@plt>
test   %rax,%rax
jne    1182 <monitoring_ctrlc+0x32>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"\0AExiting[%d]...\0A\00"
@.str.1 = [35 x i8] c"Error shutting down PQoS library!\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define void @monitoring_ctrlc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @stop_monitoring()
%6 = call i64 (...) @pqos_fini()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
%13 = load i32, i32* @EXIT_SUCCESS
%14 = call i32 @exit(i32 %13)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0AExiting[%d]...\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [34 x i8] c"Error shutting down PQoS library!\00"
define void @monitoring_ctrlc(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @stop_monitoring()
%4 = tail call i64 (...) @pqos_fini()
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
%11 = load i32, i32* @EXIT_SUCCESS
%12 = tail call i32 @exit(i32 %11)
unreachable
}