// File: /workspace/github_c_makefile_star2_O1/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 0xdb6(%rip), %rdi       # 0x2004
leaq 0xdb9(%rip), %rsi       # 0x200e
callq 0x1050
testq %rax, %rax
je 0x1425
movq %rax, %rbx
leaq 0xdc8(%rip), %rdi       # 0x2035
movl $0x11, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x1080
leaq 0xdc1(%rip), %rdi       # 0x2047
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
leaq 0xdbc(%rip), %rdi       # 0x205b
movl $0xb, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
leaq 0xdaf(%rip), %rdi       # 0x2067
movl $0x1a, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
leaq 0xdb1(%rip), %rsi       # 0x2082
movq %rbx, %rdi
movl $0x41, %edx
xorl %eax, %eax
callq 0x1040
movq %rbx, %rdi
callq 0x1030
cmpl $-0x1, %eax
je 0x142a
leaq 0xdcc(%rip), %rdi       # 0x20c4
leaq 0xd0f(%rip), %rsi       # 0x200e
callq 0x1050
testq %rax, %rax
je 0x142f
movq %rax, %rbx
leaq 0xddc(%rip), %rdi       # 0x20f3
movl $0x16, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x1080
leaq 0xdda(%rip), %rdi       # 0x210a
movl $0x16, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
leaq 0xdd8(%rip), %rdi       # 0x2121
movl $0xb, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
movl $0x1, %ebp
leaq 0x2739(%rip), %r15      # 0x3aa0
leaq 0xdf5(%rip), %r14       # 0x2163
leaq 0xdb8(%rip), %r12       # 0x212d
movq %r15, %rax
movl (%rax), %ecx
addq $0x18, %rax
testl %ecx, %ecx
je 0x1386
cmpl %ebp, %ecx
jne 0x1378
testl %ecx, %ecx
je 0x13a1
movq -0x10(%rax), %rdx
movq -0x8(%rax), %rcx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1040
jmp 0x13e7
callq 0x1060
cmpl %eax, %ebp
jl 0x13b3
callq 0x1090
cmpl %eax, %ebp
jle 0x13bf
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebp, %ecx
jmp 0x13e0
callq 0x1060
movl %ebp, %r13d
subl %eax, %r13d
callq 0x1060
movl %ebp, %ecx
subl %eax, %ecx
movq %rbx, %rdi
leaq 0xd60(%rip), %rsi       # 0x213d
movl %r13d, %edx
xorl %eax, %eax
callq 0x1040
incl %ebp
cmpl $0x41, %ebp
jne 0x1375
leaq 0xd90(%rip), %rdi       # 0x2185
movl $0x3, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
movq %rbx, %rdi
callq 0x1030
cmpl $-0x1, %eax
je 0x1434
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1128
callq 0x1100
callq 0x10d8
callq 0x10b0