#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*/ print_sigset(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char const *);
int sigpending(int /*<<< orphan*/ *);
int print_pending_sigs(const char *msg) {
  sigset_t pending_sigs;
  if (msg != NULL) {
    printf("%s", msg);
  }
  if (sigpending(&pending_sigs) == -1) {
    return -1;
  }
  print_sigset("\t\t", &pending_sigs);
  return 0;
}


x86 assembly (clang, -O0):
<print_pending_sigs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1157 <print_pending_sigs+0x27>
mov    -0x10(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    -0x14(%rbp),%rdi
call   1050 <sigpending@plt>
cmp    $0xffffffff,%eax
jne    1175 <print_pending_sigs+0x45>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <print_pending_sigs+0x5c>
lea    0xe87(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <print_sigset@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pending_sigs>:
push   %rax
test   %rdi,%rdi
je     1145 <print_pending_sigs+0x15>
mov    %rdi,%rsi
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
lea    0x4(%rsp),%rdi
call   1050 <sigpending@plt>
cmp    $0xffffffff,%eax
je     1169 <print_pending_sigs+0x39>
lea    0xea8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <print_sigset@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"\09\09\00"
define i32 @print_pending_sigs(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %1
%11 = call i32 @sigpending(i32* %4)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 -1, i32* %2
br label %16
14: ; preds = %10
%15 = call i32 @print_sigset(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %2
br label %16
16: ; preds = %14, %13
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"\09\09\00"
define i32 @print_pending_sigs(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %1
%8 = call i32 @sigpending(i32* %2)
%9 = icmp eq i32 %8, -1
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = call i32 @print_sigset(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %7, %10
%13 = phi i32 [ 0, %10 ], [ -1, %7 ]
ret i32 %13
}