// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x3, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x46a94
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x30(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x468ea
xorl %eax, %eax
movq %rax, -0x38(%rbp)
jmp 0x46903
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0xc(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6e, %eax
je 0x46923
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4e, %eax
jne 0x46958
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x4693d
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x46958
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x46958
movl -0x20(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x46a84
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x78, %eax
je 0x46970
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x58, %eax
jne 0x469a5
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x4698a
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x469a5
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x469a5
movl -0x20(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x20(%rbp)
jmp 0x46a82
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x65, %eax
je 0x469bd
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x45, %eax
jne 0x46a05
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x469d7
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x46a05
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x46a05
cmpq $0x0, -0x30(%rbp)
je 0x46a05
movl $0x0, -0x1c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x46a80
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x70, %eax
je 0x46a1d
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x50, %eax
jne 0x46a65
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x46a37
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x46a65
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x46a65
cmpq $0x0, -0x30(%rbp)
je 0x46a65
movl $0x1, -0x1c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x46a7e
movq -0x8(%rbp), %rdi
leaq 0xcd6e0(%rip), %rax     # 0x114150
movq 0x80(%rax), %rsi
callq 0x35a70
jmp 0x46af3
jmp 0x46a80
jmp 0x46a82
jmp 0x46a84
jmp 0x46a86
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x468a9
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x3acc0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %r8
movl -0x1c(%rbp), %r9d
xorl %eax, %eax
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x46690
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)