// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movl $0x0, 0x44(%rsp)
movl %edi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x100000, 0x14(%rsp)   # imm = 0x100000
movb $0x0, 0xb(%rsp)
movb $0x1, 0xa(%rsp)
movl 0x40(%rsp), %edi
movq 0x38(%rsp), %rsi
leaq 0x2e82(%rip), %rdx      # 0x4174
callq 0x1130
movl %eax, 0x10(%rsp)
cmpl $-0x1, %eax
je 0x13e6
movl 0x10(%rsp), %eax
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0x13, %eax
ja 0x13cd
movq (%rsp), %rax
leaq 0x2cdf(%rip), %rcx      # 0x4004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x4c9b(%rip), %rax      # 0x5fd0
movq (%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x13e1
movq 0x4c87(%rip), %rax      # 0x5fd0
movq (%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x13e1
movb $0x1, 0xb(%rsp)
jmp 0x13e1
movq 0x4c69(%rip), %rax      # 0x5fd0
movq (%rax), %rdi
callq 0x1510
movb %al, 0xa(%rsp)
cmpb $0x0, %al
jne 0x13a3
movq 0x4c72(%rip), %rax      # 0x5ff0
movq (%rax), %rdi
movq 0x4c48(%rip), %rax      # 0x5fd0
movq (%rax), %rdx
leaq 0x2def(%rip), %rsi      # 0x4181
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
jmp 0x13e1
movq 0x4c24(%rip), %rax      # 0x5fd0
movq (%rax), %rdi
callq 0x15a0
movl %eax, 0x14(%rsp)
jmp 0x13e1
movq 0x4c0f(%rip), %rax      # 0x5fd0
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x13e1
jmp 0x13cd
movq 0x38(%rsp), %rdi
callq 0x1270
movl $0x1, %edi
callq 0x1150
jmp 0x12e2
cmpl $0x0, 0x14(%rsp)
jg 0x1401
movq 0x38(%rsp), %rdi
callq 0x1270
movl $0x1, %edi
callq 0x1150
movb 0xb(%rsp), %cl
movb 0xa(%rsp), %al
movq 0x20(%rsp), %rdx
movzbl %cl, %edi
movzbl %al, %esi
callq 0x17d0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x1448
movq 0x4bc3(%rip), %rax      # 0x5ff0
movq (%rax), %rdi
leaq 0x2d66(%rip), %rsi      # 0x419d
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
movq 0x18(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x1b10
movzbl %al, %eax
movl %eax, 0xc(%rsp)
cmpl $0x14, 0xc(%rsp)
je 0x1471
movb $0x0, %al
callq 0x1640
movq 0x18(%rsp), %rdi
callq 0x18b0
movl 0xc(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
nop