// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/src/t_string.c
// Function: setCommand
void setCommand(redisClient *c) {
    int j;
    robj *expire = NULL;
    int unit = UNIT_SECONDS;
    int flags = REDIS_SET_NO_FLAGS;

    // 设置选项参数
    for (j = 3; j < c->argc; j++) {
        char *a = c->argv[j]->ptr;
        robj *next = (j == c->argc-1) ? NULL : c->argv[j+1];

        if ((a[0] == 'n' || a[0] == 'N') &&
            (a[1] == 'x' || a[1] == 'X') && a[2] == '\0') {
            flags |= REDIS_SET_NX;
        } else if ((a[0] == 'x' || a[0] == 'X') &&
                   (a[1] == 'x' || a[1] == 'X') && a[2] == '\0') {
            flags |= REDIS_SET_XX;
        } else if ((a[0] == 'e' || a[0] == 'E') &&
                   (a[1] == 'x' || a[1] == 'X') && a[2] == '\0' && next) {
            unit = UNIT_SECONDS;
            expire = next;
            j++;
        } else if ((a[0] == 'p' || a[0] == 'P') &&
                   (a[1] == 'x' || a[1] == 'X') && a[2] == '\0' && next) {
            unit = UNIT_MILLISECONDS;
            expire = next;
            j++;
        } else {
            addReply(c,shared.syntaxerr);
            return;
        }
    }

    // 尝试对值对象进行编码
    c->argv[2] = tryObjectEncoding(c->argv[2]);

    setGenericCommand(c,flags,c->argv[1],c->argv[2],expire,unit,NULL,NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x30(%rdi), %eax
leal -0x1(%rax), %edx
movq 0x38(%rdi), %rcx
pushq $0x3
popq %rsi
xorl %r14d, %r14d
pushq $0x1
popq %rdi
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpl %eax, %esi
jge 0x3621e
movslq %esi, %r9
cmpl %edx, %esi
jne 0x36103
xorl %r8d, %r8d
jmp 0x36108
movq 0x8(%rcx,%r9,8), %r8
movq (%rcx,%r9,8), %r9
movq 0x8(%r9), %r9
movzbl (%r9), %r10d
cmpl $0x45, %r10d
je 0x361a2
cmpl $0x4e, %r10d
je 0x36154
cmpl $0x50, %r10d
je 0x361ca
cmpl $0x58, %r10d
je 0x36180
cmpl $0x65, %r10d
je 0x361a2
cmpl $0x78, %r10d
je 0x36180
cmpl $0x70, %r10d
je 0x361ca
cmpl $0x6e, %r10d
jne 0x361fe
movzbl 0x1(%r9), %r11d
orl $0x20, %r11d
cmpl $0x78, %r11d
jne 0x3616e
cmpb $0x0, 0x2(%r9)
je 0x361f9
cmpl $0x50, %r10d
je 0x361ca
cmpl $0x65, %r10d
je 0x361a2
cmpl $0x58, %r10d
jne 0x361fe
movzbl 0x1(%r9), %r11d
orl $0x20, %r11d
cmpl $0x78, %r11d
jne 0x36196
cmpb $0x0, 0x2(%r9)
je 0x361f4
cmpl $0x70, %r10d
je 0x361ca
cmpl $0x65, %r10d
jne 0x361fe
movzbl 0x1(%r9), %r11d
orl $0x20, %r11d
cmpl $0x78, %r11d
jne 0x361c4
cmpb $0x0, 0x2(%r9)
jne 0x361c4
testq %r8, %r8
je 0x361c4
incl %esi
xorl %r14d, %r14d
jmp 0x361ea
cmpl $0x50, %r10d
jne 0x361fe
movzbl 0x1(%r9), %r10d
orl $0x20, %r10d
cmpl $0x78, %r10d
jne 0x361fe
cmpb $0x0, 0x2(%r9)
jne 0x361fe
testq %r8, %r8
je 0x361fe
incl %esi
movl %edi, %r14d
movq %r8, %r15
incl %esi
jmp 0x360ef
orl $0x2, %ebp
jmp 0x361ed
orl $0x1, %ebp
jmp 0x361ed
leaq 0x915fb(%rip), %rax     # 0xc7800
movq 0x80(%rax), %rsi
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2c10d
movq 0x10(%rcx), %rdi
callq 0x2ef4c
movq 0x38(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %r8
movl %r14d, %r9d
callq 0x35f64
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq