#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 /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void func_sigusr1(int signo) {
  int i = 0;
  printf("INFO: Catching SIGUSR1, Mask all the other signal!\nCount down 10s "
         "to exit process!\n");
  for (i = 10; i > 0; i--) {
    sleep(1);
  }
  printf("WARN: Exit the process!\n");
  exit(0);
}


x86 assembly (clang, -O0):
<func_sigusr1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1177 <func_sigusr1+0x47>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1155 <func_sigusr1+0x25>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<func_sigusr1>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [84 x i8] c"INFO: Catching SIGUSR1, Mask all the other signal!\0ACount down 10s to exit process!\0A\00"
@.str.1 = [25 x i8] c"WARN: Exit the process!\0A\00"
define void @func_sigusr1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
store i32 10, i32* %3
br label %5
5: ; preds = %10, %1
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 @sleep(i32 1)
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, -1
store i32 %12, i32* %3
br label %5
13: ; preds = %5
%14 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [83 x i8] c"INFO: Catching SIGUSR1, Mask all the other signal!\0ACount down 10s to exit process!\00"
@str.2 = [24 x i8] c"WARN: Exit the process!\00"
define void @func_sigusr1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @sleep(i32 1)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @sleep(i32 1)
%7 = tail call i32 @sleep(i32 1)
%8 = tail call i32 @sleep(i32 1)
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @sleep(i32 1)
%11 = tail call i32 @sleep(i32 1)
%12 = tail call i32 @sleep(i32 1)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.2, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
}