// File: /workspace/github_c_makefile_star2_O2/ikbenlike[P]nngutils/src/env.c
// Function: parse_arg
struct env_args *parse_arg(struct env_args *args, int argc, char **argv){
    args->unset = calloc(1, sizeof(char*) * argc);
    args->args = calloc(1, sizeof(char*) * argc);
    args->vars = calloc(1, sizeof(char*) * argc);
    args->nunset = 0;
    args->nvar = 0;
    args->argc = 0;
    args->command = NULL;
    bool com = false;
    if(args->unset == NULL || args->args == NULL || args->vars == NULL){
        fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
        exit(1);
    }
    for(int i = 1; i < argc; i++){
        if(argv[i][0] == '-'){
            if(!strcmp(argv[i], "-i") || !strcmp(argv[i], "--ignore-environment") || !strcmp(argv[i], "-")){
                args->ignore_env = true;
            }
            else if(!strcmp(argv[i], "-0") || !strcmp(argv[i], "--null")){
                args->null = true;
            }
            else if(!strcmp(argv[i], "-u")){
                if(i + 1 >= argc){
                    fprintf(stderr, "%s: missing operand after -u\n", argv[0]);
                    exit(1);
                }
                else {
                    args->unset[args->nunset++] = argv[++i];
                }
            }
        }
        else if(strchr(argv[i], '=') != NULL && com == false){
            args->vars[args->nvar++] = argv[i];
        }
        else {
            args->command = argv[i];
            for(int a = i; a < argc; a++){
                args->args[args->argc++] = argv[a];
            }
            args->args[args->argc] = NULL;
            break;
        }
    }
    return args;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x30(%rbp)
movq %rdi, %rbx
movl %esi, -0x34(%rbp)
movslq %esi, %rax
movq %rax, -0x48(%rbp)
leaq (,%rax,8), %r13
pushq $0x1
popq %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x1070
movq %rax, %r14
movq %rax, 0x8(%rbx)
movq %r15, %rdi
movq %r13, %rsi
callq 0x1070
movq %rax, %r12
movq %rax, 0x20(%rbx)
movq %r15, %rdi
movq %r13, %rsi
callq 0x1070
movq %rax, 0x30(%rbx)
andl $0x0, 0x10(%rbx)
andl $0x0, 0x38(%rbx)
andl $0x0, 0x28(%rbx)
andq $0x0, 0x18(%rbx)
testq %r14, %r14
je 0x13d0
testq %r12, %r12
je 0x13d0
testq %rax, %rax
je 0x13d0
pushq $0x1
popq %r13
movq $0x0, -0x40(%rbp)
xorl %r14d, %r14d
cmpl -0x34(%rbp), %r13d
jge 0x13be
movslq %r13d, %r15
movq -0x30(%rbp), %rax
movq (%rax,%r15,8), %r12
cmpb $0x2d, (%r12)
jne 0x134a
cmpb $0x69, 0x1(%r12)
jne 0x12bc
cmpb $0x0, 0x2(%r12)
je 0x1371
movq %r12, %rdi
leaq 0xd46(%rip), %rsi       # 0x200c
callq 0x1090
testl %eax, %eax
je 0x1371
cmpb $0x0, 0x1(%r12)
je 0x1371
cmpb $0x30, 0x1(%r12)
jne 0x12f3
cmpb $0x0, 0x2(%r12)
je 0x137c
movq %r12, %rdi
leaq 0xd24(%rip), %rsi       # 0x2021
callq 0x1090
testl %eax, %eax
je 0x137c
cmpb $0x75, 0x1(%r12)
jne 0x1374
cmpb $0x0, 0x2(%r12)
jne 0x1374
incl %r13d
cmpl -0x34(%rbp), %r13d
jge 0x1406
movslq %r13d, %rax
movq -0x30(%rbp), %rcx
movq (%rcx,%rax,8), %rax
movq 0x8(%rbx), %rcx
movq -0x40(%rbp), %rsi
movslq %esi, %rdx
incl %esi
movl %esi, 0x10(%rbx)
movq %rax, (%rcx,%rdx,8)
movl %esi, %eax
movq %rax, -0x40(%rbp)
jmp 0x1374
movq %r12, %rdi
pushq $0x3d
popq %rsi
callq 0x1060
testq %rax, %rax
je 0x1382
movq 0x30(%rbx), %rax
movslq %r14d, %rcx
leal 0x1(%r14), %edx
movl %edx, 0x38(%rbx)
movq %r12, (%rax,%rcx,8)
movl %edx, %r14d
jmp 0x1374
movb $0x1, (%rbx)
incl %r13d
jmp 0x1288
movb $0x1, 0x1(%rbx)
jmp 0x1374
movq %r12, 0x18(%rbx)
movq -0x30(%rbp), %rax
leaq (%rax,%r15,8), %rcx
xorl %eax, %eax
movq -0x48(%rbp), %r8
leaq (%r15,%rax), %rdx
cmpq %r8, %rdx
jge 0x13b5
movq (%rcx,%rax,8), %rdx
movq 0x20(%rbx), %rsi
leaq 0x1(%rax), %rdi
movl %edi, 0x28(%rbx)
movq %rdx, (%rsi,%rax,8)
movq %rdi, %rax
jmp 0x1394
movq 0x20(%rbx), %rcx
andq $0x0, (%rcx,%rax,8)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2c21(%rip), %rax      # 0x3ff8
movq (%rax), %rbx
movq -0x30(%rbp), %rax
movq (%rax), %r14
callq 0x1040
movl (%rax), %edi
callq 0x10e0
leaq 0xc10(%rip), %rsi       # 0x2004
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10a0
jmp 0x1425
movq 0x2beb(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
leaq 0xc0a(%rip), %rsi       # 0x2028
xorl %eax, %eax
callq 0x10a0
pushq $0x1
popq %rdi
callq 0x10d0