// File: /workspace/github_c_makefile_star2_O1/ijleesw[P]data-compression/src/lz78/main.c
// Function: main
int main(int argc, char* argv[]) {
    char* name_in = NULL;
    char* name_out = NULL;
    char* w_argv = NULL;
    wrapper* w;
    int bsize = B_SIZE_DEFAULT;
    int opt, ret;
    uint8_t w_mode = WRAPPER_MODE_COMPRESS;
    uint8_t w_type = LZ78_ALGORITHM;

    while ((opt = getopt(argc, argv, "i:o:dt:b:a:h")) != -1) {
        switch (opt) {
            case 'i': /* Input */
                name_in = optarg;
                break;

            case 'o': /* Output */
                name_out = optarg;
                break;

            case 'd': /* Decompress */
                w_mode = WRAPPER_MODE_DECOMPRESS;
                break;

            case 't': /* Type */
                if (!(w_type = get_algorithm(optarg))) {
                    fprintf(stderr, "Invalid algorithm type: %s\n", optarg);
                    exit(EXIT_FAILURE);
                }
                break;

            case 'b': /* Buffer size */
                bsize = byte_size(optarg);
                break;

            case 'a': /* Additional parameter */
                w_argv = optarg;
                break;

            case 'h': /* Compressor help */
            default:
                help(argv);
                exit(EXIT_FAILURE);
        }
    }

    if (bsize <= 0) {
        help(argv);
        exit(EXIT_FAILURE);
    }

    /* Creates a wrapper instance */
    w = wrapper_new(w_mode, w_type, w_argv);


    if (w == NULL) {
        fprintf(stderr, "Unable to create wrapper\n");
        exit(EXIT_FAILURE);
    }

    /* Executes the wrapper function */
    ret = wrapper_exec(w, name_in, name_out);
    


    if (ret != WRAPPER_SUCCESS)
        wrapper_perror();



    /* Destroyes the wrapper instance */
    wrapper_destroy(w);



    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movl %edi, %r13d
movb $0x1, %bpl
movl $0x100000, 0x4(%rsp)    # imm = 0x100000
movq $0x0, 0x20(%rsp)
leaq 0x1ced(%rip), %r14      # 0x3148
movq 0x3b6e(%rip), %r12      # 0x4fd0
leaq 0x1b9b(%rip), %r15      # 0x3004
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movl %r13d, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1130
cmpl $0x74, %eax
jne 0x14ab
movq (%r12), %rdi
callq 0x1596
movl %eax, %ebp
testb %al, %al
jne 0x1484
jmp 0x1569
leal -0x61(%rax), %ecx
cmpl $0x8, %ecx
ja 0x14c7
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movq (%r12), %rax
movq %rax, 0x20(%rsp)
jmp 0x1484
cmpl $-0x1, %eax
je 0x1503
cmpl $0x6f, %eax
jne 0x1561
movq (%r12), %rax
movq %rax, 0x8(%rsp)
jmp 0x1484
movq (%r12), %rdi
callq 0x15aa
movl %eax, 0x4(%rsp)
jmp 0x1484
movb $0x1, %al
movq %rax, 0x18(%rsp)
jmp 0x1484
movq (%r12), %rax
movq %rax, 0x10(%rsp)
jmp 0x1484
cmpl $0x0, 0x4(%rsp)
jle 0x156e
movzbl 0x18(%rsp), %edi
movzbl %bpl, %esi
movq 0x20(%rsp), %rdx
callq 0x1675
testq %rax, %rax
je 0x1576
movq %rax, %rbx
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x186b
movl %eax, %ebp
cmpb $0x14, %al
je 0x1544
xorl %eax, %eax
callq 0x15ef
movzbl %bpl, %ebp
movq %rbx, %rdi
callq 0x16d7
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x11fc
callq 0x119e
movq %rbx, %rdi
callq 0x11ee
callq 0x11c9
nop