// File: /workspace/github_c_makefile_star2_O3/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, -0x38(%rbp)
movq %rdi, %rbx
movl %esi, -0x2c(%rbp)
movslq %esi, %rax
movq %rax, -0x48(%rbp)
leaq (,%rax,8), %r13
movl $0x1, %edi
movq %r13, %rsi
callq 0x1070
movq %rax, %r14
movq %rax, 0x8(%rbx)
movl $0x1, %edi
movq %r13, %rsi
callq 0x1070
movq %rax, %r12
movq %rax, 0x20(%rbx)
movl $0x1, %edi
movq %r13, %rsi
callq 0x1070
movq %rax, 0x30(%rbx)
xorl %ecx, %ecx
movl %ecx, 0x10(%rbx)
movl %ecx, 0x38(%rbx)
movl %ecx, 0x28(%rbx)
movq $0x0, 0x18(%rbx)
testq %r14, %r14
je 0x1552
testq %r12, %r12
je 0x1552
testq %rax, %rax
je 0x1552
cmpl $0x2, -0x2c(%rbp)
jl 0x1540
movl $0x1, %r14d
movq $0x0, -0x40(%rbp)
xorl %r12d, %r12d
movslq %r14d, %r15
movq -0x38(%rbp), %rax
movq (%rax,%r15,8), %r13
cmpb $0x2d, (%r13)
jne 0x14a9
cmpb $0x69, 0x1(%r13)
jne 0x1420
cmpb $0x0, 0x2(%r13)
je 0x14d3
movq %r13, %rdi
leaq 0xbe2(%rip), %rsi       # 0x200c
callq 0x1090
testl %eax, %eax
je 0x14d3
cmpb $0x0, 0x1(%r13)
je 0x14d3
cmpb $0x30, 0x1(%r13)
jne 0x1454
cmpb $0x0, 0x2(%r13)
je 0x14e5
movq %r13, %rdi
leaq 0xbc3(%rip), %rsi       # 0x2021
callq 0x1090
testl %eax, %eax
je 0x14e5
cmpb $0x75, 0x1(%r13)
jne 0x14d6
cmpb $0x0, 0x2(%r13)
jne 0x14d6
incl %r14d
cmpl -0x2c(%rbp), %r14d
jge 0x155b
movslq %r14d, %rax
movq -0x38(%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 0x14d6
movq %r13, %rdi
movl $0x3d, %esi
callq 0x1060
testq %rax, %rax
je 0x14eb
movq 0x30(%rbx), %rax
movslq %r12d, %rcx
leal 0x1(%r12), %edx
movl %edx, 0x38(%rbx)
movq %r13, (%rax,%rcx,8)
movl %edx, %r12d
jmp 0x14d6
movb $0x1, (%rbx)
incl %r14d
cmpl -0x2c(%rbp), %r14d
jl 0x13f8
jmp 0x1540
movb $0x1, 0x1(%rbx)
jmp 0x14d6
movq %r13, 0x18(%rbx)
cmpl -0x2c(%rbp), %r14d
jge 0x1532
movq -0x38(%rbp), %rax
leaq (%rax,%r15,8), %rcx
movq -0x48(%rbp), %r9
subq %r15, %r9
xorl %eax, %eax
movabsq $0x100000000, %rsi      # imm = 0x100000000
xorl %edx, %edx
addq %rsi, %rax
movq (%rcx,%rdx,8), %rdi
movq 0x20(%rbx), %r8
movq %rdi, (%r8,%rdx,8)
incq %rdx
cmpq %rdx, %r9
jne 0x1512
movl %edx, 0x28(%rbx)
sarq $0x20, %rax
jmp 0x1534
xorl %eax, %eax
movq 0x20(%rbx), %rcx
movq $0x0, (%rcx,%rax,8)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x112a
movq -0x38(%rbp), %rdi
callq 0x1100