// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r12
movl %edi, %r14d
movq 0x25c5a(%rip), %rax     # 0x27fa0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0xa4(%rbp), %rbx
movq %rbx, %rdi
callq 0x3524
movl $0x41c80000, 0x14(%rbx) # imm = 0x41C80000
movq 0x25c76(%rip), %rax     # 0x27fe0
andl $0x0, (%rax)
movl $0x0, -0x2c(%rbp)
leaq 0x14d2a(%rip), %r15     # 0x170a5
movq 0x25c2e(%rip), %r13     # 0x27fb0
leaq 0x14c87(%rip), %rbx     # 0x17010
movl %r14d, %edi
movq %r12, %rsi
movq %r15, %rdx
leaq 0x25d77(%rip), %rcx     # 0x28110
leaq -0xd8(%rbp), %r8
callq 0x21d0
leal -0x62(%rax), %ecx
cmpl $0x16, %ecx
ja 0x23c4
movslq (%rbx,%rcx,4), %rax
addq %rbx, %rax
jmpq *%rax
movq (%r13), %rdi
callq 0x2120
movl %eax, -0x6c(%rbp)
jmp 0x2389
testl %eax, %eax
je 0x2389
cmpl $0x42, %eax
je 0x24c6
cmpl $0x43, %eax
je 0x24d7
cmpl $0x49, %eax
jne 0x24e3
movq (%r13), %rdi
callq 0x2120
movl %eax, -0x88(%rbp)
jmp 0x2389
movq (%r13), %rdi
callq 0x2190
movl %eax, -0x70(%rbp)
jmp 0x2389
movq (%r13), %rdi
callq 0x2190
movl %eax, -0x68(%rbp)
jmp 0x2389
andl $0x0, -0x7c(%rbp)
jmp 0x2389
pushq $0x1
popq %rax
movl %eax, -0x2c(%rbp)
jmp 0x2389
movl $0x1, -0x78(%rbp)
jmp 0x2389
movq (%r13), %rdi
callq 0x2120
movl %eax, -0x84(%rbp)
jmp 0x2389
movq (%r13), %rdi
leaq 0x14c68(%rip), %rsi     # 0x170ba
callq 0x20f0
movq %rax, -0x40(%rbp)
testq %rax, %rax
jne 0x2389
jmp 0x2b5d
movq (%r13), %rdi
callq 0x2190
movl %eax, -0x8c(%rbp)
jmp 0x2389
movq (%r13), %r13
movq %r13, %rdi
pushq $0x3a
popq %rsi
callq 0x2050
testq %rax, %rax
je 0x24b3
movq %rax, %r15
movq %r13, %rdi
callq 0x2190
movl %eax, -0x94(%rbp)
incq %r15
movq %r15, %rdi
callq 0x2190
movl %eax, -0x98(%rbp)
leaq 0x14beb(%rip), %r15     # 0x170a5
movq 0x25aef(%rip), %r13     # 0x27fb0
jmp 0x2389
movq (%r13), %rdi
callq 0x2120
movl %eax, -0x80(%rbp)
jmp 0x2389
andl $0x0, -0xa4(%rbp)
jmp 0x2389
cmpl $-0x1, %eax
jne 0x2b37
leaq 0x77b(%rip), %rsi       # 0x2c6e
pushq $0x2
popq %rdi
callq 0x2100
cmpl $0x0, -0x2c(%rbp)
je 0x27ce
movq 0x25acc(%rip), %rbx     # 0x27fd8
movslq (%rbx), %rax
cmpl %r14d, %eax
jge 0x27e1
movq (%r12,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x252b
cmpb $0x0, 0x1(%rdi)
je 0x2b7e
incl %eax
movl %eax, (%rbx)
leaq 0x14bba(%rip), %rsi     # 0x170f0
callq 0x20f0
movq %rax, %r14
testq %rax, %rax
je 0x2be8
leaq -0xa4(%rbp), %rdi
callq 0x95cf
testq %rax, %rax
je 0x2ba2
movq %rax, -0x50(%rbp)
callq 0x7da4
movq %rax, -0xb8(%rbp)
movl $0x2dc6c0, %edi         # imm = 0x2DC6C0
callq 0x35f2
leaq -0xd8(%rbp), %rcx
movq %rax, 0x10(%rcx)
leaq 0x25d38(%rip), %r15     # 0x282c0
movq 0x25a41(%rip), %r12     # 0x27fd0
xorl %r8d, %r8d
xorl %r13d, %r13d
movl $0x0, -0x48(%rbp)
cmpb $0x0, 0x3023dd(%rip)    # 0x304980
jne 0x27eb
cmpl $0x2dc6bf, %r8d         # imm = 0x2DC6BF
jg 0x25e9
testl %r13d, %r13d
jne 0x25e9
movslq %r8d, %rdi
addq %r15, %rdi
movl $0x2dc6c0, %edx         # imm = 0x2DC6C0
subl %r8d, %edx
pushq $0x1
popq %rsi
movq %r14, %rcx
movl %r8d, %ebx
callq 0x2180
xorl %r13d, %r13d
testl %eax, %eax
setle %r13b
movl $0x0, %ecx
cmovlel %ecx, %eax
addl %ebx, %eax
movl %eax, %r8d
cmpl $0x3, %r8d
jl 0x27eb
movl %r8d, %ecx
leaq (%r15,%rcx), %rbx
leaq (%rcx,%r15), %rdx
addq $-0x3, %rdx
leal 0x3(%r15), %eax
addq $-0x6, %rcx
movq %r15, %rsi
cmpq %rdx, %rsi
jae 0x26a7
cmpb $0x0, (%rsi)
jne 0x2627
cmpb $0x0, 0x1(%rsi)
jne 0x2627
cmpb $0x1, 0x2(%rsi)
je 0x2631
incq %rsi
incl %eax
decq %rcx
jmp 0x260d
leaq 0x3(%rsi), %rdi
cmpq %rdx, %rdi
jae 0x2653
cmpb $0x0, (%rdi)
jne 0x264b
cmpb $0x0, 0x1(%rdi)
jne 0x264b
cmpb $0x1, 0x2(%rdi)
je 0x2653
incq %rdi
decq %rcx
jmp 0x2635
movl %r13d, -0x2c(%rbp)
testq %rcx, %rcx
movq %rdi, %r13
cmoveq %rbx, %r13
cmpl $0x2dc6c0, %r8d         # imm = 0x2DC6C0
cmovgeq %rdi, %r13
movl %r13d, %ecx
subl %eax, %ecx
testl %ecx, %ecx
jg 0x26c4
movl -0x2c(%rbp), %r13d
testl %r13d, %r13d
leaq 0x25c3d(%rip), %r15     # 0x282c0
jne 0x27eb
movq (%r12), %rcx
leaq 0x14aaf(%rip), %rdi     # 0x17143
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x21e0
xorl %r8d, %r8d
jmp 0x259c
movq (%r12), %rdi
leaq 0x14a7a(%rip), %rsi     # 0x1712c
movl %r8d, %edx
xorl %eax, %eax
callq 0x2170
xorl %r8d, %r8d
jmp 0x259c
movl %r8d, -0x5c(%rbp)
addq $0x3, %rsi
movl %r13d, %edx
subl %eax, %edx
leaq -0xd8(%rbp), %r15
movq %r15, %rdi
callq 0x951c
movq -0x50(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movq %r15, %rdx
callq 0x97fb
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
je 0x279c
movq %rbx, -0xb0(%rbp)
xorl %ebx, %ebx
movq %r14, -0x58(%rbp)
movslq 0x8(%rcx), %rax
cmpq %rax, %rbx
jge 0x2792
cmpq $0x1, %rbx
pushq $0x2
popq %r14
sbbl $0x0, %r14d
xorl %r12d, %r12d
movl 0x4(%rcx), %eax
cltd
idivl %r14d
cmpl %eax, %r12d
jge 0x277f
movslq 0xc(%rcx,%rbx,4), %rdi
movslq %r12d, %r15
imulq %r15, %rdi
addq 0x20(%rcx,%rbx,8), %rdi
movl (%rcx), %eax
cltd
idivl %r14d
movslq %eax, %rdx
pushq $0x1
popq %rsi
movq -0x40(%rbp), %rcx
callq 0x21e0
movq -0x38(%rbp), %rax
movslq 0xc(%rax,%rbx,4), %rdi
imulq %r15, %rdi
addq 0x20(%rax,%rbx,8), %rdi
movl (%rax), %eax
cltd
idivl %r14d
movl %eax, %esi
pushq $0x1
popq %rdx
callq 0x3b3d
incl %r12d
movq -0x38(%rbp), %rcx
jmp 0x2722
incq %rbx
movq -0x58(%rbp), %r14
movq 0x25843(%rip), %r12     # 0x27fd0
jmp 0x270a
incl -0x48(%rbp)
movq -0xb0(%rbp), %rbx
subq %r13, %rbx
leaq 0x25b1a(%rip), %r15     # 0x282c0
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x21b0
movl -0x5c(%rbp), %r8d
addl %r15d, %r8d
subl %r13d, %r8d
movl -0x2c(%rbp), %r13d
jmp 0x259c
callq 0x2c44
jmp 0x283c
movq 0x25803(%rip), %rbx     # 0x27fd8
movslq (%rbx), %rax
addl $-0x2, %r14d
cmpl %r14d, %eax
jle 0x2852
callq 0x2c44
pushq $-0x1
popq %rbx
jmp 0x283e
callq 0x7da4
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
callq 0x2110
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x2130
movq -0x50(%rbp), %rdi
callq 0xa5b4
movq %r14, %rdi
callq 0x20b0
movq -0x40(%rbp), %rdi
movq 0x25779(%rip), %rax     # 0x27fa0
cmpq (%rax), %rdi
je 0x2831
callq 0x20b0
movl -0x48(%rbp), %edx
testl %edx, %edx
jg 0x2bb5
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x2865
cmpb $0x0, 0x1(%rdi)
je 0x2b91
incl %eax
movl %eax, (%rbx)
leaq 0x14880(%rip), %rsi     # 0x170f0
callq 0x20f0
movq %rax, %r13
movl (%rbx), %eax
testq %r13, %r13
je 0x2c27
leal 0x1(%rax), %ecx
movl %ecx, (%rbx)
cltq
movq (%r12,%rax,8), %rdi
leaq -0xd8(%rbp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2160
movl %eax, -0xa0(%rbp)
movq (%rbx), %rdi
incq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2160
movl %eax, -0x9c(%rbp)
pushq $0x2
popq %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x20c0
testl %eax, %eax
jne 0x28e0
movq %r13, %rdi
callq 0x2030
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x20c0
leaq -0xa4(%rbp), %rdi
callq 0xe630
testq %rax, %rax
je 0x2c06
movq %rax, %rbx
movq %rax, %rdi
callq 0x33f0
movq %rax, -0x38(%rbp)
callq 0x7da4
movq %rax, -0x58(%rbp)
pushq $0x1
popq %r15
leaq 0x259a8(%rip), %r12     # 0x282c0
xorl %r14d, %r14d
movl $0x0, -0x2c(%rbp)
movq %r13, -0x50(%rbp)
movq %rbx, -0x48(%rbp)
cmpb $0x0, 0x30204f(%rip)    # 0x304980
jne 0x2a8a
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0xa0(%rbp), %rax
movslq -0x9c(%rbp), %rdx
imulq %rax, %rdx
movq %r15, %rsi
movq %r13, %rcx
callq 0x2180
testq %rax, %rax
je 0x2a8a
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x9c(%rbp), %eax
imull -0xa0(%rbp), %eax
cltd
pushq $0x4
popq %rcx
idivl %ecx
movslq %eax, %rdx
movq %r15, %rsi
movq %r13, %rcx
callq 0x2180
testq %rax, %rax
je 0x2a8a
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdi
movl -0x9c(%rbp), %eax
imull -0xa0(%rbp), %eax
cltd
pushq $0x4
popq %rcx
idivl %ecx
movslq %eax, %rdx
movq %r15, %rsi
movq %r13, %rcx
callq 0x2180
testq %rax, %rax
je 0x2a8a
movq -0x38(%rbp), %rcx
movq %rbx, %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x64(%rbp), %rdx
callq 0xec4e
testl %eax, %eax
js 0x2a69
xorl %ebx, %ebx
xorl %r13d, %r13d
movslq -0x64(%rbp), %rax
cmpq %rax, %r13
jge 0x2a59
movl $0x2dc6c0, -0x60(%rbp)  # imm = 0x2DC6C0
movq -0xc0(%rbp), %rcx
addq %rbx, %rcx
movq %r12, %rdi
leaq -0x60(%rbp), %rsi
pushq $0x1
popq %rdx
callq 0xe999
testl %eax, %eax
jle 0x2a30
movl %eax, %edx
movq %r12, %rdi
movq %r15, %rsi
movq -0x40(%rbp), %rcx
callq 0x21e0
addq %rax, %r14
jmp 0x2a32
js 0x2a3b
incq %r13
addq $0x18, %rbx
jmp 0x29ed
movq 0x2558e(%rip), %rcx     # 0x27fd0
movq (%rcx), %rdi
negl %eax
leaq 0x14781(%rip), %rsi     # 0x171cf
movl %eax, %edx
xorl %eax, %eax
callq 0x2170
jmp 0x2a32
incl -0x2c(%rbp)
movq -0x50(%rbp), %r13
movq -0x48(%rbp), %rbx
jmp 0x292a
movq 0x25560(%rip), %rax     # 0x27fd0
movq (%rax), %rcx
leaq 0x14739(%rip), %rdi     # 0x171b3
pushq $0x1b
popq %rsi
movq %r15, %rdx
callq 0x21e0
jmp 0x29e8
callq 0x7da4
movq %rax, %r15
movq -0x38(%rbp), %rdi
callq 0x34e9
movq %rbx, %rdi
callq 0x10073
movq 0x25526(%rip), %rax     # 0x27fd0
movq (%rax), %rsi
pushq $0xa
popq %rdi
callq 0x2130
movq %r13, %rdi
callq 0x20b0
movq -0x40(%rbp), %rdi
movq 0x254d8(%rip), %rax     # 0x27fa0
cmpq (%rax), %rdi
je 0x2ad2
callq 0x20b0
xorl %ebx, %ebx
movl -0x2c(%rbp), %r8d
testl %r8d, %r8d
je 0x283e
cvtsi2sd %r8d, %xmm0
mulsd 0x1451a(%rip), %xmm0    # 0x17008
subq -0x58(%rbp), %r15
cvtsi2sd %r15, %xmm1
divsd %xmm1, %xmm0
movq 0x254ce(%rip), %rax     # 0x27fd0
movq (%rax), %rdi
imulq $0xc8, %r14, %rax
movl %r8d, %ecx
cqto
idivq %rcx
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
leaq 0x146d2(%rip), %rsi     # 0x171f7
movl %r8d, %edx
movq %rax, %rcx
movb $0x1, %al
callq 0x2170
jmp 0x283e
movq 0x25492(%rip), %rax     # 0x27fd0
movq (%rax), %rdi
movq 0x25480(%rip), %rax     # 0x27fc8
movl (%rax), %edx
leaq 0x1458a(%rip), %rsi     # 0x170db
xorl %eax, %eax
callq 0x2170
jmp 0x27e6
movq 0x2546c(%rip), %rax     # 0x27fd0
movq (%rax), %rdi
movq (%r13), %rdx
leaq 0x1454b(%rip), %rsi     # 0x170bd
xorl %eax, %eax
callq 0x2170
jmp 0x27e6
movq 0x2543b(%rip), %rcx     # 0x27fc0
movq (%rcx), %r14
incl %eax
movl %eax, (%rbx)
jmp 0x2547
movq 0x25428(%rip), %rcx     # 0x27fc0
movq (%rcx), %r13
incl %eax
jmp 0x2883
movq 0x25427(%rip), %rax     # 0x27fd0
movq (%rax), %rcx
leaq 0x1455f(%rip), %rdi     # 0x17112
jmp 0x2c17
cvtsi2sd %edx, %xmm0
mulsd 0x14447(%rip), %xmm0    # 0x17008
subq -0xb8(%rbp), %rbx
cvtsi2sd %rbx, %xmm1
divsd %xmm1, %xmm0
movq (%r12), %rdi
leaq 0x14580(%rip), %rsi     # 0x1715c
movb $0x1, %al
callq 0x2170
jmp 0x283c
movq 0x253e1(%rip), %rax     # 0x27fd0
movq (%rax), %rdi
movslq (%rbx), %rax
movq -0x8(%r12,%rax,8), %rdx
leaq 0x144f2(%rip), %rsi     # 0x170f3
jmp 0x2b72
movq 0x253c3(%rip), %rax     # 0x27fd0
movq (%rax), %rcx
leaq 0x14582(%rip), %rdi     # 0x17199
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x21e0
jmp 0x27e6
cltq
movq 0x253a0(%rip), %rcx     # 0x27fd0
movq (%rcx), %rdi
movq -0x8(%r12,%rax,8), %rdx
leaq 0x14536(%rip), %rsi     # 0x17175
jmp 0x2b72