// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/x264.c
// Function: main
int main( int argc, char **argv )
{
    x264_t *h;
    x264_param_t param;
    x264_picture_t *pic;

    FILE    *fyuv;
    FILE    *fh26l;
    FILE    *fout = stdout;

    char    *p;

    int     i_frame, i_frame_total;
    int64_t i_start, i_end;
    int64_t i_file;

    int     b_decompress = 0;

#ifdef _MSC_VER
    _setmode(_fileno(stdin), _O_BINARY);    /* thanks to Marcos Morais <morais at dee.ufcg.edu.br> */
    _setmode(_fileno(stdout), _O_BINARY);
#endif

    x264_param_default( &param );
    param.f_fps = 25.0;

    /* Parse command line options */
    opterr = 0; // no error message
    for( ;; )
    {
        int long_options_index;
        static struct option long_options[] =
        {
            { "help",    no_argument,       NULL, 'h' },
            { "bitrate", required_argument, NULL, 'b' },
            { "bframe",  required_argument, NULL, 'B' },
            { "iframe",  required_argument, NULL, 'i' },
            { "idrframe",  required_argument, NULL, 'I' },
            { "nf",      no_argument,       NULL, 'n' },
            { "cabac",   no_argument,       NULL, 'c' },
            { "qp",      required_argument, NULL, 'q' },
            { "ref",     required_argument, NULL, 'r' },
            { "no-asm",  no_argument,       NULL, 'C' },
            { "sar",     required_argument, NULL, 's' },
            { "output",  required_argument, NULL, 'o' },
            {0, 0, 0, 0}
        };

        int c;

        c = getopt_long( argc, argv, "hi:b:r:cxB:m:q:no:s:",
                         long_options, &long_options_index);

        if( c == -1 )
        {
            break;
        }

        switch( c )
        {
            case 0:
                break;
            case 'h':
                help();
                return 0;
            case 'b':
                param.i_bitrate = atol( optarg );
                break;
            case 'B':
                param.i_bframe = atol( optarg );
                break;
            case 'i':
                param.i_iframe = atol( optarg );
                break;
            case 'I':
                param.i_idrframe = atol( optarg );
                break;
            case 'n':
                param.b_deblocking_filter = 0;
                break;
            case 'q':
                param.i_qp_constant = atoi( optarg );
                break;
            case 'r':
                param.i_frame_reference = atoi( optarg );
                break;
            case 'c':
                param.b_cabac = 1;
                break;
            case 'm':
                param.i_me = atoi( optarg );
                break;
            case 'x':
                b_decompress = 1;
                break;
            case 'C':
                param.cpu = 0;
                break;
            case'o':
                if( ( fout = fopen( optarg, "wb" ) ) == NULL )
                {
                    fprintf( stderr, "cannot open output file `%s'\n", optarg );
                    return -1;
                }
                break;
            case 's':
            {
                char *p = strchr( optarg, ':' );
                if( p )
                {
                    param.vui.i_sar_width = atoi( optarg );
                    param.vui.i_sar_height = atoi( p + 1 );
                }
                break;
            }
            default:
                fprintf( stderr, "unknown option (%c)\n", optopt );
                return -1;
        }
    }

    /* Control-C handler */
    signal( SIGINT, SigIntHandler );

    if( b_decompress )
    {
        x264_nal_t nal;
        int i_data;
        int b_eof;

        if( optind > argc - 1 )
        {
            help();
            return -1;
        }

        if( !strcmp( argv[optind], "-" ) )
        {
            fh26l = stdin;
            optind++;
        }
        else if( ( fh26l = fopen( argv[optind++], "rb" ) ) == NULL )
        {
            fprintf( stderr, "could not open h26l file '%s'\n", argv[optind - 1] );
            return -1;
        }

        //param.cpu = 0;
        if( ( h = x264_decoder_open( &param ) ) == NULL )
        {
            fprintf( stderr, "x264_decoder_open failed\n" );
            return -1;
        }

        i_start = x264_mdate();
        b_eof = 0;
        i_frame = 0;
        i_data  = 0;
        nal.p_payload = (uint8_t*)x264_malloc( DATA_MAX );

        while( !i_ctrl_c )
        {
            uint8_t *p, *p_next, *end;
            int i_size;
            /* fill buffer */
            if( i_data < DATA_MAX && !b_eof )
            {
                int i_read = fread( &data[i_data], 1, DATA_MAX - i_data, fh26l );
                if( i_read <= 0 )
                {
                    b_eof = 1;
                }
                else
                {
                    i_data += i_read;
                }
            }

            if( i_data < 3 )
            {
                break;
            }

            end = &data[i_data];

            /* extract one nal */
            p = &data[0];
            while( p < end - 3 )
            {
                if( p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01 )
                {
                    break;
                }
                p++;
            }

            if( p >= end - 3 )
            {
                fprintf( stderr, "garbage (i_data = %d)\n", i_data );
                i_data = 0;
                continue;
            }

            p_next = p + 3;
            while( p_next < end - 3 )
            {
                if( p_next[0] == 0x00 && p_next[1] == 0x00 && p_next[2] == 0x01 )
                {
                    break;
                }
                p_next++;
            }

            if( p_next == end - 3 && i_data < DATA_MAX )
            {
                p_next = end;
            }

            /* decode this nal */
            i_size = p_next - p - 3;
            if( i_size <= 0 )
            {
                if( b_eof )
                {
                    break;
                }
                fprintf( stderr, "nal too large (FIXME) ?\n" );
                i_data = 0;
                continue;
            }

            x264_nal_decode( &nal, p +3, i_size );

            /* decode the content of the nal */
            x264_decoder_decode( h, &pic, &nal );

            if( pic != NULL )
            {
                int i;

                i_frame++;

                for( i = 0; i < pic->i_plane;i++ )
                {
                    int i_line;
                    int i_div;

                    i_div = i==0 ? 1 : 2;
                    for( i_line = 0; i_line < pic->i_height/i_div; i_line++ )
                    {
                        fwrite( pic->plane[i]+i_line*pic->i_stride[i], 1, pic->i_width/i_div, fout );
                        dumpByte( pic->plane[i]+i_line*pic->i_stride[i], pic->i_width/i_div, 1    );
                        
                    }
                }
            }

            memmove( &data[0], p_next, end - p_next );
            i_data -= p_next - &data[0];
        }

        i_end = x264_mdate();
        free( nal.p_payload );
        fprintf( stderr, "\n" );

        x264_decoder_close( h );

        fclose( fh26l );
        if( fout != stdout )
        {
            fclose( fout );
        }
        if( i_frame > 0 )
        {
            double fps = (double)i_frame * (double)1000000 /
                         (double)( i_end - i_start );
            fprintf( stderr, "decoded %d frames %ffps\n", i_frame, fps );
        }
    }
    else
    {
        if( optind > argc - 2 )
        {
            help();
            return -1;
        }

        /* init params */
        if( !strcmp( argv[optind], "-" ) )
        {
            fyuv = stdin;
            optind++;
        }
        else if( ( fyuv = fopen( argv[optind++], "rb" ) ) == NULL )
        {
            fprintf( stderr, "could not open yuv input file '%s'\n", argv[optind - 1] );
            return -1;
        }

        param.i_width           = strtol( argv[optind++], &p, 0 );
        param.i_height          = strtol( p+1, &p, 0 );

        i_frame_total = 0;
        if( !fseek( fyuv, 0, SEEK_END ) )
        {
            int64_t i_size = ftell( fyuv );
            fseek( fyuv, 0, SEEK_SET );
            i_frame_total = i_size / ( param.i_width * param.i_height * 3 / 2 );
        }

        if( ( h = x264_encoder_open( &param ) ) == NULL )
        {
            fprintf( stderr, "x264_encoder_open failed\n" );
            return -1;
        }

        pic = x264_picture_new( h );

        i_start = x264_mdate();
        for( i_frame = 0, i_file = 0; i_ctrl_c == 0 ; i_frame++ )
        {
            int         i_nal;
            x264_nal_t  *nal;

            int         i;

           /* i420  =   y = w*h
                      u = w*h/4
                      v = w*h/4  
            */
            
            //fillByte(pic->plane[0],  param.i_width , param.i_height);
            ///* read a frame
            if( fread( pic->plane[0], 1, param.i_width * param.i_height, fyuv ) <= 0 ||
                fread( pic->plane[1], 1, param.i_width * param.i_height / 4, fyuv ) <= 0 ||
                fread( pic->plane[2], 1, param.i_width * param.i_height / 4, fyuv ) <= 0 )
            {
                break;
            }
            
           // if(i_frame == 16 ) break; //arvind
            
            if( x264_encoder_encode( h, &nal, &i_nal, pic ) < 0 )
            {
                fprintf( stderr, "x264_encoder_encode failed\n" );
            }

            for( i = 0; i < i_nal; i++ )
            {
                int i_size;
                int i_data;

                i_data = DATA_MAX;
                if( ( i_size = x264_nal_encode( data, &i_data, 1, &nal[i] ) ) > 0 )
                {
                    i_file += fwrite( data, 1, i_size, fout );
                }
                else if( i_size < 0 )
                {
                    fprintf( stderr,
                             "need to increase buffer size (size=%d)\n", -i_size );
                }
            }
        }
        i_end = x264_mdate();
        x264_picture_delete( pic );
        x264_encoder_close( h );
        fprintf( stderr, "\n" );

        fclose( fyuv );
        if( fout != stdout )
        {
            fclose( fout );
        }

        if( i_frame > 0 )
        {
            double fps = (double)i_frame * (double)1000000 /
                         (double)( i_end - i_start );

            fprintf( stderr, "encoded %d frames %ffps %lld kb/s\n", i_frame, fps, i_file * 8 * 25 / i_frame / 1000 );
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x33c40(%rip), %rax     # 0x35fa0
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0xa4(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4200
movss 0x22c82(%rip), %xmm0    # 0x25004
movss %xmm0, -0x44(%rbp)
movq 0x33c52(%rip), %rax     # 0x35fe0
movl $0x0, (%rax)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x22e8b(%rip), %rdx     # 0x2522d
leaq 0x33d57(%rip), %rcx     # 0x36100
leaq -0xa8(%rbp), %r8
callq 0x21c0
movl %eax, -0xac(%rbp)
cmpl $-0x1, -0xac(%rbp)
jne 0x23c9
jmp 0x25af
movl -0xac(%rbp), %eax
movq %rax, -0x148(%rbp)
subq $0x78, %rax
ja 0x257d
movq -0x148(%rbp), %rax
leaq 0x22c22(%rip), %rcx     # 0x25010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x25aa
callq 0x30b0
movl $0x0, -0x4(%rbp)
jmp 0x309a
movq 0x33b9c(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2110
movl %eax, -0x20(%rbp)
jmp 0x25aa
movq 0x33b85(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2110
movl %eax, -0x34(%rbp)
jmp 0x25aa
movq 0x33b6e(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2110
movl %eax, -0x38(%rbp)
jmp 0x25aa
movq 0x33b57(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2110
movl %eax, -0x3c(%rbp)
jmp 0x25aa
movl $0x0, -0x30(%rbp)
jmp 0x25aa
movq 0x33b34(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2180
movl %eax, -0x24(%rbp)
jmp 0x25aa
movq 0x33b1d(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2180
movl %eax, -0x40(%rbp)
jmp 0x25aa
movl $0x1, -0x2c(%rbp)
jmp 0x25aa
movq 0x33afa(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2180
movl %eax, -0x1c(%rbp)
jmp 0x25aa
movl $0x1, -0xa4(%rbp)
jmp 0x25aa
movl $0x0, -0x58(%rbp)
jmp 0x25aa
movq 0x33ac8(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
leaq 0x22d50(%rip), %rsi     # 0x25242
callq 0x20e0
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
jne 0x252f
movq 0x33ac8(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movq 0x33a9e(%rip), %rax     # 0x35fb0
movq (%rax), %rdx
leaq 0x22d29(%rip), %rsi     # 0x25245
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
jmp 0x25aa
movq 0x33a78(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
movl $0x3a, %esi
callq 0x2050
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x257b
movq 0x33a53(%rip), %rax     # 0x35fb0
movq (%rax), %rdi
callq 0x2180
movl %eax, -0x48(%rbp)
movq -0xb8(%rbp), %rdi
addq $0x1, %rdi
callq 0x2180
movl %eax, -0x4c(%rbp)
jmp 0x25aa
movq 0x33a4c(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movq 0x33a3a(%rip), %rax     # 0x35fc8
movl (%rax), %edx
leaq 0x22ccc(%rip), %rsi     # 0x25263
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
jmp 0x2394
movl $0x2, %edi
leaq 0xb15(%rip), %rsi       # 0x30d0
callq 0x20f0
cmpl $0x0, -0xa4(%rbp)
je 0x2bef
movq 0x33a04(%rip), %rax     # 0x35fd8
movl (%rax), %eax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x25f1
callq 0x30b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
movq -0x10(%rbp), %rax
movq 0x339dc(%rip), %rcx     # 0x35fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x22c6e(%rip), %rsi     # 0x25278
callq 0x2140
cmpl $0x0, %eax
jne 0x2639
movq 0x339a5(%rip), %rax     # 0x35fc0
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq 0x339af(%rip), %rax     # 0x35fd8
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x339a3(%rip), %rax     # 0x35fd8
movl %ecx, (%rax)
jmp 0x26ae
movq -0x10(%rbp), %rax
movq 0x33994(%rip), %rcx     # 0x35fd8
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movq 0x33986(%rip), %rdx     # 0x35fd8
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x22c18(%rip), %rsi     # 0x2527a
callq 0x20e0
movq %rax, -0x70(%rbp)
cmpq $0x0, %rax
jne 0x26ac
movq 0x33958(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x33952(%rip), %rcx     # 0x35fd8
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x22be4(%rip), %rsi     # 0x2527d
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
jmp 0x26ae
leaq -0x58(%rbp), %rdi
callq 0xec90
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x26e5
movq 0x33908(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x22bca(%rip), %rsi     # 0x2529c
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
callq 0xb970
movq %rax, -0x90(%rbp)
movl $0x0, -0xd8(%rbp)
movl $0x0, -0x84(%rbp)
movl $0x0, -0xd4(%rbp)
movl $0x2dc6c0, %edi         # imm = 0x2DC6C0
callq 0x43c0
movq %rax, -0xc0(%rbp)
cmpl $0x0, 0x310ab9(%rip)    # 0x3131e0
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2735
jmp 0x2b2d
cmpl $0x2dc6c0, -0xd4(%rbp)  # imm = 0x2DC6C0
jge 0x27a6
cmpl $0x0, -0xd8(%rbp)
jne 0x27a6
movslq -0xd4(%rbp), %rax
leaq 0x343c8(%rip), %rdi     # 0x36b20
addq %rax, %rdi
movl $0x2dc6c0, %eax         # imm = 0x2DC6C0
subl -0xd4(%rbp), %eax
movslq %eax, %rdx
movq -0x70(%rbp), %rcx
movl $0x1, %esi
callq 0x2170
movl %eax, -0xf8(%rbp)
cmpl $0x0, -0xf8(%rbp)
jg 0x2792
movl $0x1, -0xd8(%rbp)
jmp 0x27a4
movl -0xf8(%rbp), %eax
addl -0xd4(%rbp), %eax
movl %eax, -0xd4(%rbp)
jmp 0x27a6
cmpl $0x3, -0xd4(%rbp)
jge 0x27b4
jmp 0x2b2d
movslq -0xd4(%rbp), %rcx
leaq 0x3435e(%rip), %rax     # 0x36b20
addq %rcx, %rax
movq %rax, -0xf0(%rbp)
leaq 0x3434d(%rip), %rax     # 0x36b20
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0xf0(%rbp), %rcx
addq $-0x3, %rcx
cmpq %rcx, %rax
jae 0x2836
movq -0xe0(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x2822
movq -0xe0(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x2822
movq -0xe0(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x1, %eax
jne 0x2822
jmp 0x2836
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x27da
movq -0xe0(%rbp), %rax
movq -0xf0(%rbp), %rcx
addq $-0x3, %rcx
cmpq %rcx, %rax
jb 0x287a
movq 0x3377c(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movl -0xd4(%rbp), %edx
leaq 0x22a52(%rip), %rsi     # 0x252b6
movb $0x0, %al
callq 0x2160
movl $0x0, -0xd4(%rbp)
jmp 0x2720
movq -0xe0(%rbp), %rax
addq $0x3, %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq -0xf0(%rbp), %rcx
addq $-0x3, %rcx
cmpq %rcx, %rax
jae 0x28e8
movq -0xe8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x28d4
movq -0xe8(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x28d4
movq -0xe8(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x1, %eax
jne 0x28d4
jmp 0x28e8
movq -0xe8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe8(%rbp)
jmp 0x288c
movq -0xe8(%rbp), %rax
movq -0xf0(%rbp), %rcx
addq $-0x3, %rcx
cmpq %rcx, %rax
jne 0x2919
cmpl $0x2dc6c0, -0xd4(%rbp)  # imm = 0x2DC6C0
jge 0x2919
movq -0xf0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq -0xe0(%rbp), %rcx
subq %rcx, %rax
subq $0x3, %rax
movl %eax, -0xf4(%rbp)
cmpl $0x0, -0xf4(%rbp)
jg 0x2972
cmpl $0x0, -0xd8(%rbp)
je 0x294b
jmp 0x2b2d
movq 0x3367e(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x22971(%rip), %rsi     # 0x252cd
movb $0x0, %al
callq 0x2160
movl $0x0, -0xd4(%rbp)
jmp 0x2720
movq -0xe0(%rbp), %rsi
addq $0x3, %rsi
movl -0xf4(%rbp), %edx
leaq -0xd0(%rbp), %rdi
callq 0xeb50
movq -0x18(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0xefa0
cmpq $0x0, -0x60(%rbp)
je 0x2ae3
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl $0x0, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x2ae1
movl -0xfc(%rbp), %edx
movl $0x2, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x104(%rbp)
movl $0x0, -0x100(%rbp)
movl -0x100(%rbp), %eax
movl %eax, -0x14c(%rbp)
movq -0x60(%rbp), %rax
movl 0x4(%rax), %eax
cltd
idivl -0x104(%rbp)
movl %eax, %ecx
movl -0x14c(%rbp), %eax
cmpl %ecx, %eax
jge 0x2acb
movq -0x60(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movq 0x20(%rax,%rcx,8), %rdi
movl -0x100(%rbp), %eax
movq -0x60(%rbp), %rcx
movslq -0xfc(%rbp), %rdx
imull 0xc(%rcx,%rdx,4), %eax
cltq
addq %rax, %rdi
movq -0x60(%rbp), %rax
movl (%rax), %eax
cltd
idivl -0x104(%rbp)
movslq %eax, %rdx
movq -0x78(%rbp), %rcx
movl $0x1, %esi
callq 0x21d0
movq -0x60(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movq 0x20(%rax,%rcx,8), %rdi
movl -0x100(%rbp), %eax
movq -0x60(%rbp), %rcx
movslq -0xfc(%rbp), %rdx
imull 0xc(%rcx,%rdx,4), %eax
cltq
addq %rax, %rdi
movq -0x60(%rbp), %rax
movl (%rax), %eax
cltd
idivl -0x104(%rbp)
movl %eax, %esi
movl $0x1, %edx
callq 0x4f80
movl -0x100(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x100(%rbp)
jmp 0x2a00
jmp 0x2acd
movl -0xfc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xfc(%rbp)
jmp 0x29c7
jmp 0x2ae3
movq -0xe8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
movq -0xe8(%rbp), %rax
subq %rax, %rdx
leaq 0x3401e(%rip), %rdi     # 0x36b20
callq 0x21a0
movq -0xe8(%rbp), %rcx
leaq 0x3400b(%rip), %rax     # 0x36b20
subq %rax, %rcx
movslq -0xd4(%rbp), %rax
subq %rcx, %rax
movl %eax, -0xd4(%rbp)
jmp 0x2720
callq 0xb970
movq %rax, -0x98(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x2100
movq 0x33484(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x22b62(%rip), %rsi     # 0x256b8
movb $0x0, %al
callq 0x2160
movq -0x18(%rbp), %rdi
callq 0xfe00
movq -0x70(%rbp), %rdi
callq 0x20b0
movq -0x78(%rbp), %rax
movq 0x33426(%rip), %rcx     # 0x35fa0
cmpq (%rcx), %rax
je 0x2b88
movq -0x78(%rbp), %rdi
callq 0x20b0
cmpl $0x0, -0x84(%rbp)
jle 0x2bea
cvtsi2sdl -0x84(%rbp), %xmm0
movsd 0x22467(%rip), %xmm1    # 0x25008
mulsd %xmm1, %xmm0
movq -0x98(%rbp), %rax
subq -0x90(%rbp), %rax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x110(%rbp)
movq 0x33405(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movl -0x84(%rbp), %edx
movsd -0x110(%rbp), %xmm0
leaq 0x22703(%rip), %rsi     # 0x252e6
movb $0x1, %al
callq 0x2160
jmp 0x3093
movq 0x333e2(%rip), %rax     # 0x35fd8
movl (%rax), %eax
movl -0x8(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jle 0x2c13
callq 0x30b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
movq -0x10(%rbp), %rax
movq 0x333ba(%rip), %rcx     # 0x35fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2264c(%rip), %rsi     # 0x25278
callq 0x2140
cmpl $0x0, %eax
jne 0x2c5b
movq 0x33383(%rip), %rax     # 0x35fc0
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq 0x3338d(%rip), %rax     # 0x35fd8
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x33381(%rip), %rax     # 0x35fd8
movl %ecx, (%rax)
jmp 0x2cd0
movq -0x10(%rbp), %rax
movq 0x33372(%rip), %rcx     # 0x35fd8
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movq 0x33364(%rip), %rdx     # 0x35fd8
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x225f6(%rip), %rsi     # 0x2527a
callq 0x20e0
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
jne 0x2cce
movq 0x33336(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x33330(%rip), %rcx     # 0x35fd8
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x22644(%rip), %rsi     # 0x252ff
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
jmp 0x2cd0
movq -0x10(%rbp), %rax
movq 0x332fd(%rip), %rcx     # 0x35fd8
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movq 0x332ef(%rip), %rdx     # 0x35fd8
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x80(%rbp), %rsi
xorl %edx, %edx
callq 0x2150
movl %eax, -0x54(%rbp)
movq -0x80(%rbp), %rdi
addq $0x1, %rdi
leaq -0x80(%rbp), %rsi
xorl %edx, %edx
callq 0x2150
movl %eax, -0x50(%rbp)
movl $0x0, -0x88(%rbp)
movq -0x68(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x20c0
cmpl $0x0, %eax
jne 0x2d8d
movq -0x68(%rbp), %rdi
callq 0x2030
movq %rax, -0x118(%rbp)
movq -0x68(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x20c0
movq -0x118(%rbp), %rax
movq %rax, -0x158(%rbp)
movl -0x54(%rbp), %eax
imull -0x50(%rbp), %eax
imull $0x3, %eax, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x158(%rbp), %rax
movslq %ecx, %rcx
cqto
idivq %rcx
movl %eax, -0x88(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x179b0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x2dc4
movq 0x33229(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x22572(%rip), %rsi     # 0x25323
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x309a
movq -0x18(%rbp), %rdi
callq 0x3fc0
movq %rax, -0x60(%rbp)
callq 0xb970
movq %rax, -0x90(%rbp)
movl $0x0, -0x84(%rbp)
movq $0x0, -0xa0(%rbp)
cmpl $0x0, 0x3103e7(%rip)    # 0x3131e0
jne 0x2f9f
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rdi
movl -0x54(%rbp), %eax
imull -0x50(%rbp), %eax
movslq %eax, %rdx
movq -0x68(%rbp), %rcx
movl $0x1, %esi
callq 0x2170
cmpq $0x0, %rax
jbe 0x2e81
movq -0x60(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x54(%rbp), %eax
imull -0x50(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %eax, %rdx
movq -0x68(%rbp), %rcx
movl $0x1, %esi
callq 0x2170
cmpq $0x0, %rax
jbe 0x2e81
movq -0x60(%rbp), %rax
movq 0x30(%rax), %rdi
movl -0x54(%rbp), %eax
imull -0x50(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movslq %eax, %rdx
movq -0x68(%rbp), %rcx
movl $0x1, %esi
callq 0x2170
cmpq $0x0, %rax
ja 0x2e86
jmp 0x2f9f
movq -0x18(%rbp), %rdi
movq -0x60(%rbp), %rcx
leaq -0x128(%rbp), %rsi
leaq -0x11c(%rbp), %rdx
callq 0x18390
cmpl $0x0, %eax
jge 0x2ebe
movq 0x33123(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x22486(%rip), %rsi     # 0x2533d
movb $0x0, %al
callq 0x2160
movl $0x0, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
cmpl -0x11c(%rbp), %eax
jge 0x2f89
movl $0x2dc6c0, -0x134(%rbp) # imm = 0x2DC6C0
movq -0x128(%rbp), %rcx
movslq -0x12c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rcx
leaq 0x33c20(%rip), %rdi     # 0x36b20
leaq -0x134(%rbp), %rsi
movl $0x1, %edx
callq 0x17f60
movl %eax, -0x130(%rbp)
cmpl $0x0, %eax
jle 0x2f48
movslq -0x130(%rbp), %rdx
movq -0x78(%rbp), %rcx
leaq 0x33bf2(%rip), %rdi     # 0x36b20
movl $0x1, %esi
callq 0x21d0
addq -0xa0(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0x2f73
cmpl $0x0, -0x130(%rbp)
jge 0x2f71
movq 0x33078(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
xorl %edx, %edx
subl -0x130(%rbp), %edx
leaq 0x223ef(%rip), %rsi     # 0x25359
movb $0x0, %al
callq 0x2160
jmp 0x2f73
jmp 0x2f75
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x2ec8
jmp 0x2f8b
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x2df2
callq 0xb970
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rdi
callq 0x4180
movq -0x18(%rbp), %rdi
callq 0x1a460
movq 0x3300c(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x226ea(%rip), %rsi     # 0x256b8
movb $0x0, %al
callq 0x2160
movq -0x68(%rbp), %rdi
callq 0x20b0
movq -0x78(%rbp), %rax
movq 0x32fb7(%rip), %rcx     # 0x35fa0
cmpq (%rcx), %rax
je 0x2ff7
movq -0x78(%rbp), %rdi
callq 0x20b0
cmpl $0x0, -0x84(%rbp)
jle 0x3091
cvtsi2sdl -0x84(%rbp), %xmm0
movsd 0x21ff4(%rip), %xmm1    # 0x25008
mulsd %xmm1, %xmm0
movq -0x98(%rbp), %rax
subq -0x90(%rbp), %rax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x140(%rbp)
movq 0x32f92(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movl -0x84(%rbp), %eax
movl %eax, -0x15c(%rbp)
movsd -0x140(%rbp), %xmm0
movq -0xa0(%rbp), %rax
shlq $0x3, %rax
imulq $0x19, %rax, %rax
movslq -0x84(%rbp), %rcx
cqto
idivq %rcx
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movl -0x15c(%rbp), %edx
movq %rax, %rcx
leaq 0x222f7(%rip), %rsi     # 0x25381
movb $0x1, %al
callq 0x2160
jmp 0x3093
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw %cs:(%rax,%rax)