// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/networking.c
// Function: checkClientOutputBufferLimits
int checkClientOutputBufferLimits(client *c) {
    int soft = 0, hard = 0, class;
    unsigned long used_mem = getClientOutputBufferMemoryUsage(c);

    class = getClientType(c);
    /* For the purpose of output buffer limiting, masters are handled
     * like normal clients. */
    if (class == CLIENT_TYPE_MASTER) class = CLIENT_TYPE_NORMAL;

    if (server.client_obuf_limits[class].hard_limit_bytes &&
        used_mem >= server.client_obuf_limits[class].hard_limit_bytes)
        hard = 1;
    if (server.client_obuf_limits[class].soft_limit_bytes &&
        used_mem >= server.client_obuf_limits[class].soft_limit_bytes)
        soft = 1;

    /* We need to check if the soft limit is reached continuously for the
     * specified amount of seconds. */
    if (soft) {
        if (c->obuf_soft_limit_reached_time == 0) {
            c->obuf_soft_limit_reached_time = server.unixtime;
            soft = 0; /* First time we see the soft limit reached */
        } else {
            time_t elapsed = server.unixtime - c->obuf_soft_limit_reached_time;

            if (elapsed <=
                server.client_obuf_limits[class].soft_limit_seconds) {
                soft = 0; /* The client still did not reached the max number of
                             seconds for the soft limit to be considered
                             reached. */
            }
        }
    } else {
        c->obuf_soft_limit_reached_time = 0;
    }
    return soft || hard;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x45d60
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x466f0
movl %eax, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jne 0x46c90
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x13153d(%rip), %rax    # 0x1781d8
addq $0x620, %rax            # imm = 0x620
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x46cd7
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x13151b(%rip), %rcx    # 0x1781d8
addq $0x620, %rcx            # imm = 0x620
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jb 0x46cd7
movl $0x1, -0x10(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x1314f6(%rip), %rax    # 0x1781d8
addq $0x620, %rax            # imm = 0x620
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x46d20
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x1314d3(%rip), %rcx    # 0x1781d8
addq $0x620, %rcx            # imm = 0x620
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jb 0x46d20
movl $0x1, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x46da1
movq -0x8(%rbp), %rax
cmpq $0x0, 0x90(%rax)
jne 0x46d56
leaq 0x13149d(%rip), %rax    # 0x1781d8
movq 0x978(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x90(%rax)
movl $0x0, -0xc(%rbp)
jmp 0x46d9f
leaq 0x13147b(%rip), %rax    # 0x1781d8
movq 0x978(%rax), %rax
movq -0x8(%rbp), %rcx
subq 0x90(%rcx), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x131456(%rip), %rcx    # 0x1781d8
addq $0x620, %rcx            # imm = 0x620
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x10(%rcx), %rax
jg 0x46d9d
movl $0x0, -0xc(%rbp)
jmp 0x46d9f
jmp 0x46db0
movq -0x8(%rbp), %rax
movq $0x0, 0x90(%rax)
movb $0x1, %al
cmpl $0x0, -0xc(%rbp)
movb %al, -0x29(%rbp)
jne 0x46dc5
cmpl $0x0, -0x10(%rbp)
setne %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)