// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/sentinel.c
// Function: sentinelEvent
void sentinelEvent(int level, char *type, sentinelRedisInstance *ri,
                   const char *fmt, ...) {
    va_list ap;
    char msg[LOG_MAX_LEN];
    robj *channel, *payload;

    /* Handle %@ */
    if (fmt[0] == '%' && fmt[1] == '@') {
        sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ?
                                         NULL : ri->master;

        if (master) {
            snprintf(msg, sizeof(msg), "%s %s %s %d @ %s %s %d",
                sentinelRedisInstanceTypeStr(ri),
                ri->name, ri->addr->ip, ri->addr->port,
                master->name, master->addr->ip, master->addr->port);
        } else {
            snprintf(msg, sizeof(msg), "%s %s %s %d",
                sentinelRedisInstanceTypeStr(ri),
                ri->name, ri->addr->ip, ri->addr->port);
        }
        fmt += 2;
    } else {
        msg[0] = '\0';
    }

    /* Use vsprintf for the rest of the formatting if any. */
    if (fmt[0] != '\0') {
        va_start(ap, fmt);
        vsnprintf(msg+strlen(msg), sizeof(msg)-strlen(msg), fmt, ap);
        va_end(ap);
    }

    /* Log the message if the log level allows it to be logged. */
    if (level >= server.verbosity)
        serverLog(level,"%s %s",type,msg);

    /* Publish the message via Pub/Sub if it's not a debugging one. */
    if (level != LL_DEBUG) {
        channel = createStringObject(type,strlen(type));
        payload = createStringObject(msg,strlen(msg));
        pubsubPublishMessage(channel,payload);
        decrRefCount(channel);
        decrRefCount(payload);
    }

    /* Call the notification script if applicable. */
    if (level == LL_WARNING && ri != NULL) {
        sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ?
                                         ri : ri->master;
        if (master && master->notification_script) {
            sentinelScheduleScriptExecution(master->notification_script,
                type,msg,NULL);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x7a56d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
cmpb $0x25, (%rcx)
jne 0x7a589
cmpb $0x40, 0x1(%r15)
jne 0x7a589
movl (%r14), %eax
testb $0x1, %al
jne 0x7a596
movq 0xb8(%r14), %r10
jmp 0x7a599
movb $0x0, 0xd0(%rsp)
jmp 0x7a677
xorl %r10d, %r10d
testq %r10, %r10
je 0x7a5bc
testb $0x1, %al
jne 0x7a5da
testb $0x2, %al
jne 0x7a5ec
testb $0x4, %al
leaq 0x497e4(%rip), %rax     # 0xc3d93
leaq 0x55510(%rip), %rcx     # 0xcfac6
cmoveq %rax, %rcx
jmp 0x7a5f3
testb $0x1, %al
jne 0x7a5e3
testb $0x2, %al
jne 0x7a638
testb $0x4, %al
leaq 0x497c6(%rip), %rax     # 0xc3d93
leaq 0x554f2(%rip), %rcx     # 0xcfac6
cmoveq %rax, %rcx
jmp 0x7a63f
leaq 0x5163a(%rip), %rcx     # 0xcbc1b
jmp 0x7a5f3
leaq 0x51631(%rip), %rcx     # 0xcbc1b
jmp 0x7a63f
leaq 0x5167a(%rip), %rcx     # 0xcbc6d
movq 0x8(%r14), %r8
movq 0x20(%r14), %rax
movq (%rax), %r9
movl 0x8(%rax), %r11d
movq 0x20(%r10), %r12
movl 0x8(%r12), %r13d
leaq 0x54bc6(%rip), %rdx     # 0xcf1d8
leaq 0xd0(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
xorl %eax, %eax
pushq %r13
pushq (%r12)
pushq 0x8(%r10)
pushq %r11
callq 0x26120
addq $0x20, %rsp
jmp 0x7a673
leaq 0x5162e(%rip), %rcx     # 0xcbc6d
movq 0x8(%r14), %r8
movq 0x20(%r14), %rax
movq (%rax), %r9
movl 0x8(%rax), %r10d
subq $0x8, %rsp
leaq 0x54b96(%rip), %rdx     # 0xcf1ef
leaq 0xd8(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
xorl %eax, %eax
pushq %r10
callq 0x26120
addq $0x10, %rsp
addq $0x2, %r15
cmpb $0x0, (%r15)
je 0x7a6d0
leaq 0x20(%rsp), %rax
movq %rsp, %r12
movq %rax, 0x10(%r12)
leaq 0x510(%rsp), %rax
movq %rax, 0x8(%r12)
movabsq $0x3000000020, %rax     # imm = 0x3000000020
movq %rax, (%r12)
leaq 0xd0(%rsp), %rdi
callq 0x26510
leaq (%rsp,%rax), %rdi
addq $0xd0, %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x26820
leaq 0x8c181(%rip), %rax     # 0x106858
cmpl %ebp, 0x5e8(%rax)
jg 0x7a6fa
leaq 0x55bda(%rip), %rsi     # 0xd02c0
leaq 0xd0(%rsp), %rcx
movl %ebp, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x32ea6
testl %ebp, %ebp
je 0x7a74d
movq %rbx, %rdi
callq 0x26510
movq %rbx, %rdi
movq %rax, %rsi
callq 0x43ba8
movq %rax, %r15
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
callq 0x26510
movq %r12, %rdi
movq %rax, %rsi
callq 0x43ba8
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
callq 0x63f62
movq %r15, %rdi
callq 0x440f3
movq %r12, %rdi
callq 0x440f3
cmpl $0x3, %ebp
setne %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x7a78f
testb $0x1, (%r14)
jne 0x7a76a
movq 0xb8(%r14), %r14
testq %r14, %r14
je 0x7a78f
movq 0x120(%r14), %rdi
testq %rdi, %rdi
je 0x7a78f
leaq 0xd0(%rsp), %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x7a7d0
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq