#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*/ printf(char *, ...);
int /*<<< orphan*/ strsigabbrev(unsigned int);
int /*<<< orphan*/ strsignal(unsigned int);
unsigned long long strtoul(char *, int /*<<< orphan*/ *, int);
void prsigs(char *k, char *v) {
  unsigned i, sig;
  unsigned long long arg, bit;
  arg = strtoul(v, NULL, 16);
  printf("%s: %016llx\n\n", k, arg);
  if (!arg)
    printf("  (no signal bits set)\n");
  for (i = 0; i < 64; i++) {
    sig = i + 1;
    bit = 1ULL << i;
    if (arg & bit)
      printf("  [%16llx]  %3u | %-8s | %s\n", bit, sig, strsigabbrev(sig),
             strsignal(sig));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<prsigs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1060 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
jne    1195 <prsigs+0x55>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x40,-0x14(%rbp)
jae    1221 <prsigs+0xe1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
and    -0x28(%rbp),%rax
cmp    $0x0,%rax
je     120e <prsigs+0xce>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <strsigabbrev@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <strsignal@plt>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    %eax,%r8d
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1213 <prsigs+0xd3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119c <prsigs+0x5c>
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prsigs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <strtoul@plt>
mov    %rax,%r15
lea    0xe79(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
test   %r15,%r15
jne    11a5 <prsigs+0x45>
lea    0xe8b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe62(%rip),%r14
xor    %ebx,%ebx
jmp    11b9 <prsigs+0x59>
mov    %rbp,%rbx
cmp    $0x40,%rbp
je     11f9 <prsigs+0x99>
lea    0x1(%rbx),%rbp
mov    $0x1,%r12d
mov    %ebx,%ecx
shl    %cl,%r12
bt     %rbx,%r15
jae    11b0 <prsigs+0x50>
add    $0x1,%ebx
mov    %ebx,%edi
call   1050 <strsigabbrev@plt>
mov    %eax,%r13d
mov    %ebx,%edi
call   1070 <strsignal@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r13d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11b0 <prsigs+0x50>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%s: %016llx\0A\0A\00"
@.str.1 = [24 x i8] c" (no signal bits set)\0A\00"
@.str.2 = [29 x i8] c" [%16llx] %3u | %-8s | %s\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @prsigs(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
%10 = call i64 @strtoul(i8* %9, i32* null, i32 16)
store i64 %10, i64* %7
%11 = load i8*, i8** %3
%12 = load i64, i64* %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %11, i64 %12)
%14 = load i64, i64* %7
%15 = icmp ne i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
store i32 0, i32* %5
br label %19
19: ; preds = %41, %18
%20 = load i32, i32* %5
%21 = icmp ult i32 %20, 64
br i1 %21, label %22, label %44
22: ; preds = %19
%23 = load i32, i32* %5
%24 = add i32 %23, 1
store i32 %24, i32* %6
%25 = load i32, i32* %5
%26 = zext i32 %25 to i64
%27 = shl i64 1, %26
store i64 %27, i64* %8
%28 = load i64, i64* %7
%29 = load i64, i64* %8
%30 = and i64 %28, %29
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %22
%33 = load i64, i64* %8
%34 = load i32, i32* %6
%35 = load i32, i32* %6
%36 = call i32 @strsigabbrev(i32 %35)
%37 = load i32, i32* %6
%38 = call i32 @strsignal(i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i64 %33, i32 %34, i32 %36, i32 %38)
br label %40
40: ; preds = %32, %22
br label %41
41: ; preds = %40
%42 = load i32, i32* %5
%43 = add i32 %42, 1
store i32 %43, i32* %5
br label %19
44: ; preds = %19
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s: %016llx\0A\0A\00"
@.str.2 = [29 x i8] c" [%16llx] %3u | %-8s | %s\0A\00"
@str = [23 x i8] c" (no signal bits set)\00"
define void @prsigs(i8* %0, i8* nocapture %1) {
%3 = tail call i64 @strtoul(i8* nocapture %1, i32* null, i32 16)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %3)
%5 = icmp eq i64 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
br label %9
9: ; preds = %8, %20
%10 = phi i64 [ %11, %20 ], [ 0, %8 ]
%11 = add nuw nsw i64 %10, 1
%12 = shl nuw i64 1, %10
%13 = and i64 %12, %3
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %9
%16 = trunc i64 %11 to i32
%17 = tail call i32 @strsigabbrev(i32 %16)
%18 = tail call i32 @strsignal(i32 %16)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i64 %12, i32 %16, i32 %17, i32 %18)
br label %20
20: ; preds = %9, %15
%21 = icmp eq i64 %11, 64
br i1 %21, label %22, label %9
22: ; preds = %20
%23 = tail call i32 @putchar(i32 10)
ret void
}