// File: /workspace/github_c_makefile_star2_O0/ikbenlike[P]nngutils/src/env.c
// Function: main
int main(int argc, char **argv){
    if(argc == 1){
        for(int i = 0; environ[i] != NULL; i++){
            puts(environ[i]);
        }
        return 0;
    }
    struct env_args *args = calloc(1, sizeof(struct env_args));
    if(args == NULL){
        fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
        return 1;
    }
    args = parse_arg(args, argc, argv);
    if(args->ignore_env){
        *environ = NULL;
    }
    if(args->nunset > 0){
        for(int i = 0; i < args->nunset; i++){
            puts(args->unset[i]);
        }
    }
    if(args->nvar > 0){
        for(int i = 0; i < args->nvar; i++){
            if(putenv(args->vars[i]) != 0){
                fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
                return 1;
            }
        }
    }
    if(args->nunset > 0){
        for(int i = 0; i < args->nunset; i++){
            if(unsetenv(args->unset[i]) == -1){
                fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
                return 1;
            }
        }
    }
    if(args->command == NULL){
        for(int i = 0; environ[i] != NULL; i++){
            puts(environ[i]);
        }
        free(args->unset);
        free(args->vars);
        free(args->args);
        free(args);
        return 0;
    }
    if(execvp(args->command, args->args) == -1){
        fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
        return 1;
    }
    free(args->unset);
    free(args->vars);
    free(args->args);
    free(args);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jne 0x15a6
movl $0x0, -0x14(%rbp)
movq 0x2a76(%rip), %rax      # 0x3fe0
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x159a
movq 0x2a61(%rip), %rax      # 0x3fe0
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1050
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1563
movl $0x0, -0x4(%rbp)
jmp 0x18bc
movl $0x1, %edi
movl $0x40, %esi
callq 0x1070
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x160a
movq 0x2a31(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x1040
movl (%rax), %edi
callq 0x10e0
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq %rax, %rcx
leaq 0xa0d(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x10a0
movl $0x1, -0x4(%rbp)
jmp 0x18bc
movq -0x20(%rbp), %rdi
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x11f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
je 0x1638
movq 0x29b2(%rip), %rax      # 0x3fe0
movq (%rax), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0x1677
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1675
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1050
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1649
jmp 0x1677
movq -0x20(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jle 0x170b
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x1709
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1080
cmpl $0x0, %eax
je 0x16fc
movq 0x293f(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x1040
movl (%rax), %edi
callq 0x10e0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq %rax, %rcx
leaq 0x91b(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x10a0
movl $0x1, -0x4(%rbp)
jmp 0x18bc
jmp 0x16fe
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x168c
jmp 0x170b
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0x179f
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x179d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10b0
cmpl $-0x1, %eax
jne 0x1790
movq 0x28ab(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
callq 0x1040
movl (%rax), %edi
callq 0x10e0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq %rax, %rcx
leaq 0x887(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x10a0
movl $0x1, -0x4(%rbp)
jmp 0x18bc
jmp 0x1792
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1720
jmp 0x179f
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1824
movl $0x0, -0x30(%rbp)
movq 0x2828(%rip), %rax      # 0x3fe0
movq (%rax), %rax
movslq -0x30(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x17e8
movq 0x2813(%rip), %rax      # 0x3fe0
movq (%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1050
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x17b1
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rdi
callq 0x1030
movl $0x0, -0x4(%rbp)
jmp 0x18bc
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x10c0
cmpl $-0x1, %eax
jne 0x1885
movq 0x27b3(%rip), %rax      # 0x3ff8
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x1040
movl (%rax), %edi
callq 0x10e0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq %rax, %rcx
leaq 0x78f(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x10a0
movl $0x1, -0x4(%rbp)
jmp 0x18bc
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rdi
callq 0x1030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq