// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/debug.c
// Function: sigsegvHandler
void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
    ucontext_t *uc = (ucontext_t*) secret;
    sds infostring, clients;
    struct sigaction act;
    REDIS_NOTUSED(info);

    bugReportStart();
    redisLog(REDIS_WARNING,
        "    Redis %s crashed by signal: %d", REDIS_VERSION, sig);
    redisLog(REDIS_WARNING,
        "    Failed assertion: %s (%s:%d)", server.assert_failed,
                        server.assert_file, server.assert_line);

    /* Log the stack trace */
    redisLog(REDIS_WARNING, "--- STACK TRACE");
    logStackTrace(uc);

    /* Log INFO and CLIENT LIST */
    redisLog(REDIS_WARNING, "--- INFO OUTPUT");
    infostring = genRedisInfoString("all");
    infostring = sdscatprintf(infostring, "hash_init_value: %u\n",
        dictGetHashFunctionSeed());
    redisLogRaw(REDIS_WARNING, infostring);
    redisLog(REDIS_WARNING, "--- CLIENT LIST OUTPUT");
    clients = getAllClientsInfoString();
    redisLogRaw(REDIS_WARNING, clients);
    sdsfree(infostring);
    sdsfree(clients);

    /* Log the current client */
    logCurrentClient();

    /* Log dump of processor registers */
    logRegisters(uc);

#if defined(HAVE_PROC_MAPS)
    /* Test memory */
    redisLog(REDIS_WARNING, "--- FAST MEMORY TEST");
    bioKillThreads();
    if (memtest_test_linux_anonymous_maps()) {
        redisLog(REDIS_WARNING,
            "!!! MEMORY ERROR DETECTED! Check your memory ASAP !!!");
    } else {
        redisLog(REDIS_WARNING,
            "Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible.");
    }
#endif

    redisLog(REDIS_WARNING,
"\n=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n"
"       Please report the crash opening an issue on github:\n\n"
"           http://github.com/antirez/redis/issues\n\n"
"  Suspect RAM error? Use redis-server --test-memory to veryfy it.\n\n"
);
    /* free(messages); Don't call free() with possibly corrupted memory. */
    if (server.daemonize) unlink(server.pidfile);

    /* Make sure we exit with the right signal at the end. So for instance
     * the core will be dumped if enabled. */
    sigemptyset (&act.sa_mask);
    act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND;
    act.sa_handler = SIG_DFL;
    sigaction (sig, &act, NULL);
    kill(getpid(),sig);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r14
movl %edi, %ebx
leaq 0x7bdae(%rip), %r13     # 0xc9fa8
cmpl $0x0, 0x834(%r13)
jne 0x4e222
leaq 0x4d3fe(%rip), %rsi     # 0x9b609
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
movl $0x1, 0x834(%r13)
leaq 0x4d5b2(%rip), %rsi     # 0x9b7db
leaq 0x48740(%rip), %rdx     # 0x96970
movl $0x3, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x23064
movq 0x820(%r13), %rdx
movq 0x828(%r13), %rcx
movl 0x830(%r13), %r8d
leaq 0x4d5a4(%rip), %rsi     # 0x9b7fe
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
leaq 0x4d5b2(%rip), %rsi     # 0x9b81f
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
movq %r14, %rdi
callq 0x4dd69
leaq 0x4d5a7(%rip), %rsi     # 0x9b82f
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
leaq 0x531ff(%rip), %rdi     # 0xa149a
callq 0x2690c
movq %rax, %r15
callq 0x21ed1
leaq 0x4d590(%rip), %rsi     # 0x9b83f
movq %r15, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x28760
movq %rax, %r15
movl $0x3, %edi
movq %rax, %rsi
callq 0x22f15
leaq 0x4d582(%rip), %rsi     # 0x9b854
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
callq 0x2f227
movq %rax, %r12
movl $0x3, %edi
movq %rax, %rsi
callq 0x22f15
movq %r15, %rdi
callq 0x28204
movq %r12, %rdi
callq 0x28204
callq 0x4ddee
movq %r14, %rdi
callq 0x4dc17
leaq 0x4d554(%rip), %rsi     # 0x9b86b
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
callq 0x58d9f
callq 0x4df0a
testl %eax, %eax
leaq 0x4d580(%rip), %rax     # 0x9b8b6
leaq 0x4d543(%rip), %rsi     # 0x9b880
cmoveq %rax, %rsi
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
leaq 0x4d5dc(%rip), %rsi     # 0x9b930
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
cmpl $0x0, 0x484(%r13)
je 0x4e373
movq 0x48(%r13), %rdi
callq 0x1f3a0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x1fa40
movl $0xc8000000, 0x80(%r14) # imm = 0xC8000000
movq $0x0, -0x8(%r14)
leaq 0x8(%rsp), %rsi
movl %ebx, %edi
xorl %edx, %edx
callq 0x1f670
callq 0x1f410
movl %eax, %edi
movl %ebx, %esi
callq 0x1f620
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq