#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 SIGUSR1;
int SIGUSR2;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void childSigHandler(int sig) {
  if (sig == SIGUSR1) {
    printf("+++ Child : Received signal SIGUSR1 from parent...\n");
    sleep(1);
  } else if (sig == SIGUSR2) {
    printf("+++ Child : Received signal SIGUSR2 from parent...\n");
    sleep(5);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<childSigHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
jne    1168 <childSigHandler+0x38>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1195 <childSigHandler+0x65>
mov    -0x4(%rbp),%eax
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%eax
jne    1190 <childSigHandler+0x60>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <sleep@plt>
jmp    1195 <childSigHandler+0x65>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<childSigHandler>:
push   %rbx
mov    0x2eb0(%rip),%rax
cmp    %edi,(%rax)
jne    114a <childSigHandler+0x1a>
mov    $0x1,%ebx
lea    0xeeb(%rip),%rdi
jmp    1161 <childSigHandler+0x31>
mov    0x2e87(%rip),%rax
cmp    %edi,(%rax)
jne    116d <childSigHandler+0x3d>
mov    $0x5,%ebx
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGUSR1 = global i32 0
@.str = [52 x i8] c"+++ Child : Received signal SIGUSR1 from parent...\0A\00"
@SIGUSR2 = global i32 0
@.str.1 = [52 x i8] c"+++ Child : Received signal SIGUSR2 from parent...\0A\00"
define void @childSigHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGUSR1
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @sleep(i32 1)
br label %17
9: ; preds = %1
%10 = load i32, i32* %2
%11 = load i32, i32* @SIGUSR2
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @sleep(i32 5)
br label %16
16: ; preds = %13, %9
br label %17
17: ; preds = %16, %6
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@str = [51 x i8] c"+++ Child : Received signal SIGUSR2 from parent...\00"
@str.2 = [51 x i8] c"+++ Child : Received signal SIGUSR1 from parent...\00"
define void @childSigHandler(i32 %0) {
%2 = load i32, i32* @SIGUSR1
%3 = icmp eq i32 %2, %0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @SIGUSR2
%6 = icmp eq i32 %5, %0
br i1 %6, label %7, label %12
7: ; preds = %4, %1
%8 = phi i8* [ getelementptr inbounds ([51 x i8], [51 x i8]* @str.2, i64 0, i64 0), %1 ], [ getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0), %4 ]
%9 = phi i32 [ 1, %1 ], [ 5, %4 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %8)
%11 = tail call i32 @sleep(i32 %9)
br label %12
12: ; preds = %7, %4
%13 = tail call i32 @exit(i32 0)
unreachable
}