// File: /workspace/github_c_makefile_star2_O3/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), %ecx
movq 0x38(%rdi), %rax
cmpl $0x4, %ecx
jl 0x38b28
leal -0x1(%rcx), %edx
xorl %r15d, %r15d
movl $0x3, %esi
xorl %ebp, %ebp
xorl %r14d, %r14d
movslq %esi, %r8
cmpl %edx, %r8d
jne 0x38a09
xorl %edi, %edi
jmp 0x38a0e
movq 0x8(%rax,%r8,8), %rdi
movq (%rax,%r8,8), %r8
movq 0x8(%r8), %r8
movzbl (%r8), %r9d
cmpl $0x64, %r9d
jg 0x38a3b
cmpl $0x4f, %r9d
jg 0x38a79
cmpl $0x45, %r9d
je 0x38ac0
cmpl $0x4e, %r9d
je 0x38a51
jmp 0x38b6f
cmpl $0x6f, %r9d
jg 0x38a8a
cmpl $0x65, %r9d
je 0x38ac0
cmpl $0x6e, %r9d
jne 0x38b6f
movzbl 0x1(%r8), %r10d
orl $0x20, %r10d
cmpl $0x78, %r10d
jne 0x38a6b
cmpb $0x0, 0x2(%r8)
je 0x38b23
cmpl $0x50, %r9d
je 0x38aec
cmpl $0x65, %r9d
jne 0x38a7f
jmp 0x38ac0
cmpl $0x50, %r9d
je 0x38aec
cmpl $0x58, %r9d
je 0x38a9a
jmp 0x38b6f
cmpl $0x70, %r9d
je 0x38aec
cmpl $0x78, %r9d
jne 0x38b6f
movzbl 0x1(%r8), %r10d
orl $0x20, %r10d
cmpl $0x78, %r10d
jne 0x38ab0
cmpb $0x0, 0x2(%r8)
je 0x38b1e
cmpl $0x70, %r9d
je 0x38aec
cmpl $0x65, %r9d
jne 0x38b6f
movzbl 0x1(%r8), %r10d
orl $0x20, %r10d
cmpl $0x78, %r10d
jne 0x38ae2
cmpb $0x0, 0x2(%r8)
jne 0x38ae2
testq %rdi, %rdi
je 0x38ae2
incl %esi
xorl %r14d, %r14d
jmp 0x38b0f
cmpl $0x50, %r9d
jne 0x38b6f
movzbl 0x1(%r8), %r9d
orl $0x20, %r9d
cmpl $0x78, %r9d
jne 0x38b6f
cmpb $0x0, 0x2(%r8)
jne 0x38b6f
testq %rdi, %rdi
je 0x38b6f
incl %esi
movl $0x1, %r14d
movq %rdi, %r15
incl %esi
cmpl %ecx, %esi
jl 0x389fd
jmp 0x38b30
orl $0x2, %ebp
jmp 0x38b12
orl $0x1, %ebp
jmp 0x38b12
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x10(%rax), %rdi
callq 0x30c49
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 0x38860
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x91c8a(%rip), %rax     # 0xca800
movq 0x80(%rax), %rsi
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2d97c