#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, char *);
scalar_t__ strncasecmp(char *, char *, int);
char *strsignal(int);
void strsig(void) {
  int i;
  char *s;
  for (i = 0; i < 1024; i++) {
    s = strsignal(i);
    if (!s || strncasecmp(s, "Unknown", 7) == 0)
      continue;
    printf("%d %s\n", i, s);
  }
}


x86 assembly (clang, -O0):
<strsig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x400,-0x4(%rbp)
jge    11a8 <strsig+0x78>
mov    -0x4(%rbp),%edi
call   1050 <strsignal@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1182 <strsig+0x52>
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1187 <strsig+0x57>
jmp    119a <strsig+0x6a>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <strsig+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsig>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xebf(%rip),%r14
lea    0xec0(%rip),%r15
jmp    115b <strsig+0x2b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x400,%ebx
je     118e <strsig+0x5e>
mov    %ebx,%edi
call   1050 <strsignal@plt>
test   %rax,%rax
je     1150 <strsig+0x20>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0x7,%edx
call   1040 <strncasecmp@plt>
test   %rax,%rax
je     1150 <strsig+0x20>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
call   1030 <printf@plt>
jmp    1150 <strsig+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [7 x i8] c"%d %s\0A\00"
define void @strsig() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
br label %3
3: ; preds = %20, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1024
br i1 %5, label %6, label %23
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i8* @strsignal(i32 %7)
store i8* %8, i8** %2
%9 = load i8*, i8** %2
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = call i64 @strncasecmp(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %6
br label %20
16: ; preds = %11
%17 = load i32, i32* %1
%18 = load i8*, i8** %2
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %17, i8* %18)
br label %20
20: ; preds = %16, %15
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %3
23: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [7 x i8] c"%d %s\0A\00"
define void @strsig() {
br label %1
1: ; preds = %0, %10
%2 = phi i32 [ 0, %0 ], [ %11, %10 ]
%3 = tail call i8* @strsignal(i32 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i64 @strncasecmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* %3)
br label %10
10: ; preds = %1, %5, %8
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 1024
br i1 %12, label %13, label %1
13: ; preds = %10
ret void
}