// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x30(%rdi), %eax
cmpl $0x4, %eax
jl 0x38a92
xorl %r15d, %r15d
movl $0x3, %r12d
leaq 0x91ef7(%rip), %r13     # 0xca800
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x38(%rbx), %rcx
movslq %r12d, %rdx
decl %eax
cmpl %eax, %edx
jne 0x3891f
xorl %eax, %eax
jmp 0x38924
movq 0x8(%rcx,%rdx,8), %rax
movq (%rcx,%rdx,8), %rcx
movq 0x8(%rcx), %rcx
movzbl (%rcx), %edx
cmpl $0x64, %edx
jg 0x38950
cmpl $0x4f, %edx
jg 0x389c2
cmpl $0x45, %edx
je 0x38a10
cmpl $0x4e, %edx
je 0x38967
jmp 0x38a60
cmpl $0x6f, %edx
jg 0x389d1
cmpl $0x65, %edx
je 0x38a10
cmpl $0x6e, %edx
jne 0x38a60
movzbl 0x1(%rcx), %esi
orl $0x20, %esi
cmpl $0x78, %esi
jne 0x3897d
cmpb $0x0, 0x2(%rcx)
je 0x38a8b
leal -0x45(%rdx), %esi
cmpl $0x33, %esi
ja 0x38a60
movabsq $0x100000001, %rdi      # imm = 0x100000001
btq %rsi, %rdi
jb 0x38a10
movabsq $0x80000000800, %rdi    # imm = 0x80000000800
btq %rsi, %rdi
jb 0x38a39
movabsq $0x8000000080000, %rdi  # imm = 0x8000000080000
btq %rsi, %rdi
jb 0x389df
jmp 0x38a60
cmpl $0x50, %edx
je 0x38a39
cmpl $0x58, %edx
je 0x389df
jmp 0x38a60
cmpl $0x70, %edx
je 0x38a39
cmpl $0x78, %edx
jne 0x38a60
movzbl 0x1(%rcx), %esi
orl $0x20, %esi
cmpl $0x78, %esi
jne 0x389f5
cmpb $0x0, 0x2(%rcx)
je 0x38a86
cmpl $0x64, %edx
jg 0x38a06
cmpl $0x45, %edx
je 0x38a10
cmpl $0x50, %edx
je 0x38a39
jmp 0x38a60
cmpl $0x70, %edx
je 0x38a39
cmpl $0x65, %edx
jne 0x38a60
movzbl 0x1(%rcx), %esi
orl $0x20, %esi
cmpl $0x78, %esi
jne 0x38a31
cmpb $0x0, 0x2(%rcx)
jne 0x38a31
testq %rax, %rax
je 0x38a31
incl %r12d
movb $0x1, %cl
xorl %r14d, %r14d
jmp 0x38a5b
orl $0x20, %edx
cmpl $0x70, %edx
jne 0x38a60
movzbl 0x1(%rcx), %edx
orl $0x20, %edx
cmpl $0x78, %edx
jne 0x38a60
cmpb $0x0, 0x2(%rcx)
jne 0x38a60
testq %rax, %rax
je 0x38a60
incl %r12d
movb $0x1, %cl
movl $0x1, %r14d
movq %rax, %r15
jmp 0x38a71
movq 0x80(%r13), %rsi
movq %rbx, %rdi
callq 0x2d6f0
xorl %ecx, %ecx
testb %cl, %cl
je 0x38ad2
incl %r12d
movl 0x30(%rbx), %eax
cmpl %eax, %r12d
jl 0x3890e
jmp 0x38a9a
orl $0x2, %ebp
jmp 0x38a8e
orl $0x1, %ebp
movb $0x1, %cl
jmp 0x38a71
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x30971
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 0x3876c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq