// File: /workspace/github_c_makefile_star2_O0/skeeto[P]enchive/src/enchive.c
// Function: main
int
main(int argc, char **argv)
{
    static const struct optparse_long global[] = {
#if ENCHIVE_OPTION_AGENT
        {"agent",         'a', OPTPARSE_OPTIONAL},
        {"no-agent",      'A', OPTPARSE_NONE},
#endif
        {"pinentry",      'e', OPTPARSE_OPTIONAL},
        {"pubkey",        'p', OPTPARSE_REQUIRED},
        {"seckey",        's', OPTPARSE_REQUIRED},
        {"version",       'V', OPTPARSE_NONE},
        {"help",          'h', OPTPARSE_NONE},
        {0, 0, 0}
    };

    int option;
    char *command;
    struct optparse options[1];
    optparse_init(options, argv);
    options->permute = 0;
    (void)argc;

    while ((option = optparse_long(options, global, 0)) != -1) {
        switch (option) {
#if ENCHIVE_OPTION_AGENT
            case 'a':
                if (options->optarg) {
                    char *arg = options->optarg;
                    char *endptr;
                    errno = 0;
                    global_agent_timeout = strtol(arg, &endptr, 10);
                    if (*endptr || errno)
                        fatal("invalid --agent argument -- %s", arg);
                } else
                    global_agent_timeout = ENCHIVE_AGENT_TIMEOUT;
                break;
            case 'A':
                global_agent_timeout = 0;
                break;
#endif
            case 'e':
                if (options->optarg)
                    pinentry_path = options->optarg;
                else
                    pinentry_path = STR(ENCHIVE_PINENTRY_DEFAULT);
                break;
            case 'p':
                global_pubkey = options->optarg;
                break;
            case 's':
                global_seckey = options->optarg;
                break;
            case 'h':
                print_usage(stdout);
                exit(EXIT_SUCCESS);
                break;
            case 'V':
                print_version();
                exit(EXIT_SUCCESS);
                break;
            default:
                fatal("%s", options->errmsg);
        }
    }

    command = optparse_arg(options);
    options->permute = 1;
    if (!command) {
        fprintf(stderr, "enchive: missing command\n");
        print_usage(stderr);
        exit(EXIT_FAILURE);
    }

#ifdef _WIN32
    /* Set stdin/stdout to binary mode. */
    _setmode(0, 0x8000);
    _setmode(1, 0x8000);
#endif

    switch (parse_command(command)) {
        case COMMAND_UNKNOWN:
        case COMMAND_AMBIGUOUS:
            fprintf(stderr, "enchive: unknown command, %s\n", command);
            print_usage(stderr);
            exit(EXIT_FAILURE);
            break;
        case COMMAND_KEYGEN:
            command_keygen(options);
            break;
        case COMMAND_FINGERPRINT:
            command_fingerprint(options);
            break;
        case COMMAND_ARCHIVE:
            command_archive(options);
            break;
        case COMMAND_EXTRACT:
            command_extract(options);
            break;
    }

    cleanup_free();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2480
movl $0x0, -0x88(%rbp)
leaq -0x90(%rbp), %rdi
leaq 0xbbaf(%rip), %rsi      # 0xeca0
xorl %eax, %eax
movl %eax, %edx
callq 0x2b20
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x3239
movl -0x14(%rbp), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, -0xa8(%rbp)
subl $0x32, %eax
ja 0x321b
movq -0xa8(%rbp), %rax
leaq 0x7f0c(%rip), %rcx      # 0xb038
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpq $0x0, -0x78(%rbp)
je 0x31a0
movq -0x78(%rbp), %rax
movq %rax, -0x98(%rbp)
callq 0x2070
movl $0x0, (%rax)
movq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0xa, %edx
callq 0x2220
movl %eax, 0xc130(%rip)      # 0xf2a0
movq -0xa0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x3189
callq 0x2070
cmpl $0x0, (%rax)
je 0x319e
movq -0x98(%rbp), %rsi
leaq 0x80ab(%rip), %rdi      # 0xb242
movb $0x0, %al
callq 0x3340
jmp 0x31aa
movl $0x384, 0xc0f6(%rip)    # imm = 0x384
jmp 0x3234
movl $0x0, 0xc0e7(%rip)      # 0xf2a0
jmp 0x3234
cmpq $0x0, -0x78(%rbp)
je 0x31cf
movq -0x78(%rbp), %rax
movq %rax, 0xc0db(%rip)      # 0xf2a8
jmp 0x31dd
leaq 0x8a46(%rip), %rax      # 0xbc1c
movq %rax, 0xc0cb(%rip)      # 0xf2a8
jmp 0x3234
movq -0x78(%rbp), %rax
movq %rax, 0xc0c6(%rip)      # 0xf2b0
jmp 0x3234
movq -0x78(%rbp), %rax
movq %rax, 0xc0c1(%rip)      # 0xf2b8
jmp 0x3234
movq 0xbdd0(%rip), %rax      # 0xefd0
movq (%rax), %rdi
callq 0x34a0
xorl %edi, %edi
callq 0x2310
callq 0x34d0
xorl %edi, %edi
callq 0x2310
leaq -0x90(%rbp), %rsi
addq $0x20, %rsi
leaq 0x8bf1(%rip), %rdi      # 0xbe1e
movb $0x0, %al
callq 0x3340
jmp 0x30e3
leaq -0x90(%rbp), %rdi
callq 0x2ad0
movq %rax, -0x20(%rbp)
movl $0x1, -0x88(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x328b
movq 0xbd97(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x7ff6(%rip), %rsi      # 0xb261
movb $0x0, %al
callq 0x21f0
movq 0xbd7f(%rip), %rax      # 0xeff8
movq (%rax), %rdi
callq 0x34a0
movl $0x1, %edi
callq 0x2310
movq -0x20(%rbp), %rdi
callq 0x34f0
addl $0x2, %eax
movl %eax, %ecx
movq %rcx, -0xb0(%rbp)
subl $0x5, %eax
ja 0x332b
movq -0xb0(%rbp), %rax
leaq 0x7d69(%rip), %rcx      # 0xb020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xbd31(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
leaq 0x7fa6(%rip), %rsi      # 0xb27b
movb $0x0, %al
callq 0x21f0
movq 0xbd15(%rip), %rax      # 0xeff8
movq (%rax), %rdi
callq 0x34a0
movl $0x1, %edi
callq 0x2310
leaq -0x90(%rbp), %rdi
callq 0x3580
jmp 0x332b
leaq -0x90(%rbp), %rdi
callq 0x3a90
jmp 0x332b
leaq -0x90(%rbp), %rdi
callq 0x3b20
jmp 0x332b
leaq -0x90(%rbp), %rdi
callq 0x3e20
callq 0x41b0
xorl %eax, %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)