// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelResetMaster
void sentinelResetMaster(sentinelRedisInstance *ri, int flags) {
    serverAssert(ri->flags & SRI_MASTER);
    dictRelease(ri->slaves);
    ri->slaves = dictCreate(&instancesDictType,NULL);
    if (!(flags & SENTINEL_RESET_NO_SENTINELS)) {
        dictRelease(ri->sentinels);
        ri->sentinels = dictCreate(&instancesDictType,NULL);
    }
    instanceLinkCloseConnection(ri->link,ri->link->cc);
    instanceLinkCloseConnection(ri->link,ri->link->pc);
    ri->flags &= SRI_MASTER;
    if (ri->leader) {
        sdsfree(ri->leader);
        ri->leader = NULL;
    }
    ri->failover_state = SENTINEL_FAILOVER_STATE_NONE;
    ri->failover_state_change_time = 0;
    ri->failover_start_time = 0; /* We can failover again ASAP. */
    ri->promoted_slave = NULL;
    sdsfree(ri->runid);
    sdsfree(ri->slave_master_host);
    ri->runid = NULL;
    ri->slave_master_host = NULL;
    ri->link->act_ping_time = mstime();
    ri->link->last_ping_time = 0;
    ri->link->last_avail_time = mstime();
    ri->link->last_pong_time = mstime();
    ri->role_reported_time = mstime();
    ri->role_reported = SRI_MASTER;
    if (flags & SENTINEL_GENERATE_EVENT)
        sentinelEvent(LL_WARNING,"+reset-master",ri,"%@");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x9665f
jmp 0x96681
leaq 0xafb75(%rip), %rdi     # 0x1461db
leaq 0xaf8ef(%rip), %rsi     # 0x145f5c
movl $0x577, %edx            # imm = 0x577
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x2e230
leaq 0xe0ca8(%rip), %rdi     # 0x177340
xorl %eax, %eax
movl %eax, %esi
callq 0x2d330
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x88(%rax)
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x966e8
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x2e230
leaq 0xe0c6f(%rip), %rdi     # 0x177340
xorl %eax, %eax
movl %eax, %esi
callq 0x2d330
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x95940
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rsi
callq 0x95940
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xd8(%rax)
je 0x96752
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rdi
callq 0x38620
movq -0x8(%rbp), %rax
movq $0x0, 0xd8(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0xf0(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xf8(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x100(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x118(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x38620
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rdi
callq 0x38620
movq -0x8(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xc0(%rax)
callq 0x2ff70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq $0x0, 0x48(%rax)
callq 0x2ff70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x38(%rax)
callq 0x2ff70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x50(%rax)
callq 0x2ff70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x68(%rax)
movl -0xc(%rbp), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
je 0x96857
movq -0x8(%rbp), %rdx
movl $0x3, %edi
leaq 0xaf9b5(%rip), %rsi     # 0x1461fe
leaq 0xaf9bc(%rip), %rcx     # 0x14620c
movb $0x0, %al
callq 0x94990
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)