#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*/ check_pending();
char getchar();
int /*<<< orphan*/ install_handler();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void main() {
  install_handler();
  printf("\t======= INSTRUCTIONS =======\n");
  printf("This process once inititated would block SIGABRT, SIGINT, SIGHUP\n");
  printf(
      "To quit the process or send signals to this process, please open a new "
      "tty and find this process's PID by running the command \"ps -x\"\n");
  printf("TO BEGIN PRESS 1\n");
  char op = getchar();
  while (op) {
    printf("\n_______________________________________________\n");
    printf("Hello, this is main\n\tPENDING LIST:\n\n");
    check_pending();
    printf("_______________________________________________\n");
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <install_handler@plt>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
call   1040 <printf@plt>
lea    0xf5e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     11dd <main+0x8d>
lea    0xf50(%rip),%rdi
call   1040 <printf@plt>
lea    0xf76(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <check_pending@plt>
lea    0xf32(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1199 <main+0x49>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <install_handler@plt>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
test   %al,%al
je     120b <main+0xbb>
lea    0xf58(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xf7a(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <check_pending@plt>
lea    0xf34(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <check_pending@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    11e0 <main+0x90>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\09======= INSTRUCTIONS =======\0A\00"
@.str.1 = [66 x i8] c"This process once inititated would block SIGABRT, SIGINT, SIGHUP\0A\00"
@.str.2 = [135 x i8] c"To quit the process or send signals to this process, please open a new tty and find this process's PID by running the command \22ps -x\22\0A\00"
@.str.3 = [18 x i8] c"TO BEGIN PRESS 1\0A\00"
@.str.4 = [50 x i8] c"\0A_______________________________________________\0A\00"
@.str.5 = [37 x i8] c"Hello, this is main\0A\09PENDING LIST:\0A\0A\00"
@.str.6 = [49 x i8] c"_______________________________________________\0A\00"
define void @main() {
%1 = alloca i8
%2 = call i32 (...) @install_handler()
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %1
br label %8
8: ; preds = %11, %0
%9 = load i8, i8* %1
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (...) @check_pending()
%15 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @sleep(i32 1)
br label %8
17: ; preds = %8
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"\09======= INSTRUCTIONS =======\00"
@str.7 = [65 x i8] c"This process once inititated would block SIGABRT, SIGINT, SIGHUP\00"
@str.8 = [134 x i8] c"To quit the process or send signals to this process, please open a new tty and find this process's PID by running the command \22ps -x\22\00"
@str.9 = [17 x i8] c"TO BEGIN PRESS 1\00"
@str.10 = [49 x i8] c"\0A_______________________________________________\00"
@str.11 = [36 x i8] c"Hello, this is main\0A\09PENDING LIST:\0A\00"
@str.12 = [48 x i8] c"_______________________________________________\00"
define void @main() {
%1 = tail call i32 (...) @install_handler()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.7, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([134 x i8], [134 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%6 = tail call signext i8 (...) @getchar()
%7 = icmp eq i8 %6, 0
br i1 %7, label %20, label %8
8: ; preds = %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.10, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.11, i64 0, i64 0))
%11 = tail call i32 (...) @check_pending()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.12, i64 0, i64 0))
%13 = tail call i32 @sleep(i32 1)
br label %14
14: ; preds = %14, %8
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.10, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.11, i64 0, i64 0))
%17 = tail call i32 (...) @check_pending()
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.12, i64 0, i64 0))
%19 = tail call i32 @sleep(i32 1)
br label %14
20: ; preds = %0
ret void
}