// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/discnt-cli.c
// Function: main
int main(int argc, char **argv) {
    int firstarg;

    config.hostip = sdsnew("127.0.0.1");
    config.hostport = 5262;
    config.hostsocket = NULL;
    config.repeat = 1;
    config.interval = 0;
    config.interactive = 0;
    config.shutdown = 0;
    config.monitor_mode = 0;
    config.latency_mode = 0;
    config.latency_history = 0;
    config.stat_mode = 0;
    config.intrinsic_latency_mode = 0;
    config.pipe_mode = 0;
    config.pipe_timeout = DISCNT_CLI_DEFAULT_PIPE_TIMEOUT;
    config.stdinarg = 0;
    config.auth = NULL;
    config.eval = NULL;
    config.last_cmd_type = -1;

    if (!isatty(fileno(stdout)) && (getenv("FAKETTY") == NULL))
        config.output = OUTPUT_RAW;
    else
        config.output = OUTPUT_STANDARD;
    config.mb_delim = sdsnew("\n");
    cliInitHelp();

    firstarg = parseOptions(argc,argv);
    argc -= firstarg;
    argv += firstarg;

    signal(SIGPIPE, SIG_IGN);

    /* Latency mode */
    if (config.latency_mode) {
        if (cliConnect(0) == REDIS_ERR) exit(1);
        latencyMode();
    }

    /* Pipe mode */
    if (config.pipe_mode) {
        if (cliConnect(0) == REDIS_ERR) exit(1);
        pipeMode();
    }

    /* Stat mode */
    if (config.stat_mode) {
        if (cliConnect(0) == REDIS_ERR) exit(1);
        if (config.interval == 0) config.interval = 1000000;
        statMode();
    }

    /* Intrinsic latency mode */
    if (config.intrinsic_latency_mode) intrinsicLatencyMode();

    /* Start interactive mode when no command is provided */
    if (argc == 0 && !config.eval) {
        /* Note that in repl mode we don't abort on connection error.
         * A new attempt will be performed for every command send. */
        cliConnect(0);
        repl();
    }

    /* Otherwise, we have some arguments to execute */
    if (cliConnect(0) != REDIS_OK) exit(1);
    if (config.eval) {
        return evalMode(argc,argv);
    } else {
        return noninteractive(argc,convertToSds(argc,argv));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x71930(%rip), %rdi     # 0x82fdd
callq 0xe430
movq %rax, 0x854ff(%rip)     # 0x96bb8
movl $0x148e, 0x854fd(%rip)  # imm = 0x148E
movq $0x0, 0x854fa(%rip) # 0x96bc8
movq $0x1, 0x854f7(%rip) # 0x96bd0
movq $0x0, 0x854f4(%rip) # 0x96bd8
movl $0x0, 0x854f2(%rip)     # 0x96be0
movl $0x0, 0x854ec(%rip)     # 0x96be4
movl $0x0, 0x854e6(%rip)     # 0x96be8
movl $0x0, 0x854e4(%rip)     # 0x96bf0
movl $0x0, 0x854de(%rip)     # 0x96bf4
movl $0x0, 0x854e0(%rip)     # 0x96c00
movl $0x0, 0x854da(%rip)     # 0x96c04
movl $0x0, 0x854c4(%rip)     # 0x96bf8
movl $0x1e, 0x854be(%rip)    # 0x96bfc
movl $0x0, 0x854c4(%rip)     # 0x96c0c
movq $0x0, 0x854bd(%rip) # 0x96c10
movq $0x0, 0x8554a(%rip) # 0x96ca8
movl $0xffffffff, 0x85548(%rip) # imm = 0xFFFFFFFF
movq 0x84851(%rip), %rax     # 0x95fc0
movq (%rax), %rdi
callq 0xc380
movl %eax, %edi
callq 0xc0d0
cmpl $0x0, %eax
jne 0x117a1
leaq 0x7185d(%rip), %rdi     # 0x82fe7
callq 0xc040
cmpq $0x0, %rax
jne 0x117a1
movl $0x1, 0x85479(%rip)     # 0x96c18
jmp 0x117ab
movl $0x0, 0x8546d(%rip)     # 0x96c18
leaq 0x7215e(%rip), %rdi     # 0x83910
callq 0xe430
movq %rax, 0x85462(%rip)     # 0x96c20
callq 0x11910
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x11ad0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %ecx
movl -0x8(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x8(%rbp)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl $0xd, %edi
movl $0x1, %esi
callq 0xc300
cmpl $0x0, 0x853e8(%rip)     # 0x96bf0
je 0x11825
xorl %edi, %edi
callq 0x120b0
cmpl $-0x1, %eax
jne 0x11820
movl $0x1, %edi
callq 0xc590
callq 0x12210
cmpl $0x0, 0x853cc(%rip)     # 0x96bf8
je 0x11849
xorl %edi, %edi
callq 0x120b0
cmpl $-0x1, %eax
jne 0x11844
movl $0x1, %edi
callq 0xc590
callq 0x12410
cmpl $0x0, 0x853b0(%rip)     # 0x96c00
je 0x11882
xorl %edi, %edi
callq 0x120b0
cmpl $-0x1, %eax
jne 0x11868
movl $0x1, %edi
callq 0xc590
cmpq $0x0, 0x85368(%rip)     # 0x96bd8
jne 0x1187d
movq $0xf4240, 0x8535b(%rip) # imm = 0xF4240
callq 0x12a20
cmpl $0x0, 0x8537b(%rip)     # 0x96c04
je 0x11890
callq 0x12cf0
cmpl $0x0, -0x8(%rbp)
jne 0x118ac
cmpq $0x0, 0x8540a(%rip)     # 0x96ca8
jne 0x118ac
xorl %edi, %edi
callq 0x120b0
callq 0x12e10
xorl %edi, %edi
callq 0x120b0
cmpl $0x0, %eax
je 0x118c2
movl $0x1, %edi
callq 0xc590
cmpq $0x0, 0x853de(%rip)     # 0x96ca8
je 0x118dd
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x13110
movl %eax, -0x4(%rbp)
jmp 0x118fd
movl -0x8(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x133f0
movl -0x18(%rbp), %edi
movq %rax, %rsi
callq 0x13360
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)