// File: /workspace/github_c_makefile_star2_O2/rakitzis[P]rc/mksignal.c
// Function: main
int main(void) {
    int maxsig = NUMSIG-1;
    int s;
    struct signaming *snp;
    FILE *outf;

    for (snp = signamings; snp->signo; ++snp)
	if (snp->signo > maxsig)
	    maxsig = snp->signo;

    outf = fopen("sigmsgs.h", "w");
    if (!outf) barf("could not open sigmsgs.h for writing");
    fprintf(outf, "typedef struct {\n");
    fprintf(outf, "\tchar *name, *msg;\n");
    fprintf(outf, "} Sigmsgs;\n");
    fprintf(outf, "extern Sigmsgs signals[];\n");
    fprintf(outf, "#define NUMOFSIGNALS %d\n", maxsig+1);
    if (fclose(outf) == EOF)  barf("could not fclose sigmsgs.h after writing");

    outf = fopen("sigmsgs.c", "w");
    if (!outf) barf("could not open sigmsgs.c for writing");
    fprintf(outf, "#include \"sigmsgs.h\"\n\n");
    fprintf(outf, "Sigmsgs signals[] = {\n");
    fprintf(outf, "\t{\"\",\t\"\"},\n");

    /* yes, we could avoid the quadratic searching with an aux array. fap. */
    for (s = 1; s <= maxsig; ++s) {
	for (snp = signamings; snp->signo && snp->signo != s; ++snp)
	    /* */;
	if (snp->signo)
	    fprintf(outf, "\t{\"%s\",\t\"%s\"},\n",
		    snp->signame, snp->sigmsg);
#if defined(SIGRTMIN) && defined(SIGRTMAX)
	else if (s >= SIGRTMIN && s <= SIGRTMAX)
	    fprintf(outf, "\t{\"sigrt%d\",\t\"real-time signal %d\"},\n",
		    s - SIGRTMIN, s - SIGRTMIN);
#endif
	else
	    fprintf(outf, "\t{\"sig%d\",\t\"unknown signal %d\"},\n",
		    s, s);
    }
    fprintf(outf, "};\n");
    if (fclose(outf) == EOF) barf("could not fclose sigmsgs.c after writing");
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xe56(%rip), %rdi       # 0x2004
leaq 0xe59(%rip), %rsi       # 0x200e
callq 0x1050
testq %rax, %rax
je 0x136f
movq %rax, %rbx
leaq 0xe68(%rip), %rdi       # 0x2035
pushq $0x11
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %rax, %rcx
callq 0x1080
leaq 0xe61(%rip), %rdi       # 0x2047
pushq $0x13
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1080
leaq 0xe60(%rip), %rdi       # 0x205b
pushq $0xb
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1080
leaq 0xe57(%rip), %rdi       # 0x2067
pushq $0x1a
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1080
leaq 0xe5d(%rip), %rsi       # 0x2082
pushq $0x41
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1040
movq %rbx, %rdi
callq 0x1030
cmpl $-0x1, %eax
je 0x137b
leaq 0xe7a(%rip), %rdi       # 0x20c4
leaq 0xdbd(%rip), %rsi       # 0x200e
callq 0x1050
testq %rax, %rax
je 0x1387
movq %rax, %rbx
leaq 0xe8a(%rip), %rdi       # 0x20f3
pushq $0x16
popq %r14
pushq $0x1
popq %r15
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0x1080
leaq 0xe84(%rip), %rdi       # 0x210a
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x1080
leaq 0xe86(%rip), %rdi       # 0x2121
pushq $0xb
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x1080
pushq $0x1
popq %rbp
leaq 0x27ed(%rip), %r15      # 0x3aa0
leaq 0xea9(%rip), %r14       # 0x2163
leaq 0xe6c(%rip), %r12       # 0x212d
cmpl $0x41, %ebp
je 0x133c
movq %r15, %rax
movl (%rax), %ecx
addq $0x18, %rax
testl %ecx, %ecx
je 0x12d7
cmpl %ebp, %ecx
jne 0x12c9
testl %ecx, %ecx
je 0x12f2
movq -0x10(%rax), %rdx
movq -0x8(%rax), %rcx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1040
jmp 0x1338
callq 0x1060
cmpl %eax, %ebp
jl 0x1304
callq 0x1090
cmpl %eax, %ebp
jle 0x1310
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebp, %ecx
jmp 0x1331
callq 0x1060
movl %ebp, %r13d
subl %eax, %r13d
callq 0x1060
movl %ebp, %ecx
subl %eax, %ecx
movq %rbx, %rdi
leaq 0xe0f(%rip), %rsi       # 0x213d
movl %r13d, %edx
xorl %eax, %eax
callq 0x1040
incl %ebp
jmp 0x12c1
leaq 0xe42(%rip), %rdi       # 0x2185
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
movq %rbx, %rdi
callq 0x1030
cmpl $-0x1, %eax
je 0x1393
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc9a(%rip), %rdi       # 0x2010
callq 0x139f
leaq 0xd19(%rip), %rdi       # 0x209b
callq 0x139f
leaq 0xd40(%rip), %rdi       # 0x20ce
callq 0x139f
leaq 0xdef(%rip), %rdi       # 0x2189
callq 0x139f