// File: /workspace/github_c_makefile_star2_O2/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 0x1e8f(%rip), %r14      # 0x3148
movq 0x3d10(%rip), %r12      # 0x4fd0
leaq 0x1d3d(%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 0x1309
movq (%r12), %rdi
callq 0x1426
movl %eax, %ebp
testb %al, %al
jne 0x12e2
jmp 0x13c9
leal -0x61(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1325
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movq (%r12), %rax
movq %rax, 0x20(%rsp)
jmp 0x12e2
cmpl $-0x1, %eax
je 0x1361
cmpl $0x6f, %eax
jne 0x13bf
movq (%r12), %rax
movq %rax, 0x8(%rsp)
jmp 0x12e2
movq (%r12), %rdi
callq 0x145c
movl %eax, 0x4(%rsp)
jmp 0x12e2
movb $0x1, %al
movq %rax, 0x18(%rsp)
jmp 0x12e2
movq (%r12), %rax
movq %rax, 0x10(%rsp)
jmp 0x12e2
cmpl $0x0, 0x4(%rsp)
jle 0x13bf
movzbl 0x18(%rsp), %edi
movzbl %bpl, %esi
movq 0x20(%rsp), %rdx
callq 0x15d3
testq %rax, %rax
je 0x13ed
movq %rax, %rbx
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x17a3
movl %eax, %ebp
cmpb $0x14, %al
je 0x13a2
xorl %eax, %eax
callq 0x14a1
movzbl %bpl, %ebp
movq %rbx, %rdi
callq 0x1633
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x126c
jmp 0x13e5
movq 0x3c20(%rip), %rax      # 0x4ff0
movq (%rax), %rdi
movq (%r12), %rdx
leaq 0x1d77(%rip), %rsi      # 0x3155
xorl %eax, %eax
callq 0x10d0
pushq $0x1
popq %rdi
callq 0x1150
movq 0x3bfc(%rip), %rax      # 0x4ff0
movq (%rax), %rcx
leaq 0x1d73(%rip), %rdi      # 0x3171
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
jmp 0x13e5
nop