#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 */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ printf(char *);
int sigfillset(int /*<<< orphan*/ *);
int sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  int rc;
  sigset_t sigsus, oldset;
  rc = sigfillset(&sigsus);
  rc = sigprocmask(SIG_SETMASK, &sigsus, &oldset);
  printf(" going to sleep 5 seconds, try control-C!\n");
  sleep(5);
  printf(" going ahead\n");
  rc = sigprocmask(SIG_SETMASK, &oldset, NULL);
  for (;;) {
    printf("This is a pointless message.\n");
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <sigfillset@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    %eax,-0x14(%rbp)
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
call   1060 <sleep@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    -0x1c(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    %eax,-0x14(%rbp)
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    11b6 <main+0x76>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <sigfillset@plt>
mov    0x2e8b(%rip),%r15
mov    (%r15),%edi
lea    0x8(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <sigprocmask@plt>
lea    0xe89(%rip),%rdi
call   1040 <puts@plt>
mov    $0x5,%edi
call   1060 <sleep@plt>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
mov    (%r15),%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
lea    0xe91(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
jmp    11b0 <main+0x70>

LLVM IR (-O0):
@SIG_SETMASK = global i32 0
@.str = [43 x i8] c" going to sleep 5 seconds, try control-C!\0A\00"
@.str.1 = [14 x i8] c" going ahead\0A\00"
@.str.2 = [30 x i8] c"This is a pointless message.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @sigfillset(i32* %7)
store i32 %9, i32* %6
%10 = load i32, i32* @SIG_SETMASK
%11 = call i32 @sigprocmask(i32 %10, i32* %7, i32* %8)
store i32 %11, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @sleep(i32 5)
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @SIG_SETMASK
%16 = call i32 @sigprocmask(i32 %15, i32* %8, i32* null)
store i32 %16, i32* %6
br label %17
17: ; preds = %17, %2
%18 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @sleep(i32 1)
br label %17
}

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
@str = [42 x i8] c" going to sleep 5 seconds, try control-C!\00"
@str.3 = [13 x i8] c" going ahead\00"
@str.4 = [29 x i8] c"This is a pointless message.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @sigfillset(i32* %3)
%8 = load i32, i32* @SIG_SETMASK
%9 = call i32 @sigprocmask(i32 %8, i32* %3, i32* %4)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%11 = call i32 @sleep(i32 5)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.3, i64 0, i64 0))
%13 = load i32, i32* @SIG_SETMASK
%14 = call i32 @sigprocmask(i32 %13, i32* %4, i32* null)
br label %15
15: ; preds = %15, %2
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
%17 = call i32 @sleep(i32 1)
br label %15
}