; Listing generated by Microsoft (R) Optimizing Compiler Version 15.00.21022.08 

	TITLE	c:\Develop\DScaler423a\DScaler\avi_index.cpp
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB OLDNAMES

PUBLIC	?aviIndexSetLegacyCounters@@YAXPAUAVI_FILE@@@Z	; aviIndexSetLegacyCounters
; Function compile flags: /Odtp
; File c:\develop\dscaler423a\dscaler\avi_index.cpp
;	COMDAT ?aviIndexSetLegacyCounters@@YAXPAUAVI_FILE@@@Z
_TEXT	SEGMENT
_file$ = 8						; size = 4
?aviIndexSetLegacyCounters@@YAXPAUAVI_FILE@@@Z PROC	; aviIndexSetLegacyCounters, COMDAT

; 234  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp

; 235  :     assert(sizeof(file->legacy.indices)==sizeof(file->stdIndexCount));
; 236  :     memcpy(file->legacy.indices, file->stdIndexCount,
; 237  :                                  sizeof(file->legacy.indices));

  00003	6a 08		 push	 8
  00005	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00008	05 40 04 00 00	 add	 eax, 1088		; 00000440H
  0000d	50		 push	 eax
  0000e	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00011	81 c1 34 04 00
	00		 add	 ecx, 1076		; 00000434H
  00017	51		 push	 ecx
  00018	e8 00 00 00 00	 call	 _memcpy
  0001d	83 c4 0c	 add	 esp, 12			; 0000000cH

; 238  : }

  00020	5d		 pop	 ebp
  00021	c3		 ret	 0
?aviIndexSetLegacyCounters@@YAXPAUAVI_FILE@@@Z ENDP	; aviIndexSetLegacyCounters
_TEXT	ENDS
PUBLIC	?aviIndexClearCounters@@YAXPAUAVI_FILE@@@Z	; aviIndexClearCounters
; Function compile flags: /Odtp
;	COMDAT ?aviIndexClearCounters@@YAXPAUAVI_FILE@@@Z
_TEXT	SEGMENT
_file$ = 8						; size = 4
?aviIndexClearCounters@@YAXPAUAVI_FILE@@@Z PROC		; aviIndexClearCounters, COMDAT

; 224  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp

; 225  :     memset(file->stdIndexCount, 0, sizeof(file->stdIndexCount));

  00003	6a 08		 push	 8
  00005	6a 00		 push	 0
  00007	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  0000a	05 40 04 00 00	 add	 eax, 1088		; 00000440H
  0000f	50		 push	 eax
  00010	e8 00 00 00 00	 call	 _memset
  00015	83 c4 0c	 add	 esp, 12			; 0000000cH

; 226  : }

  00018	5d		 pop	 ebp
  00019	c3		 ret	 0
?aviIndexClearCounters@@YAXPAUAVI_FILE@@@Z ENDP		; aviIndexClearCounters
PUBLIC	?aviIndexFlushSuper@@YAXPAUAVI_FILE@@W4stream_t@@@Z ; aviIndexFlushSuper
; Function compile flags: /Odtp
;	COMDAT ?aviIndexFlushSuper@@YAXPAUAVI_FILE@@W4stream_t@@@Z
_TEXT	SEGMENT
_offset$ = -16						; size = 8
_index$ = -4						; size = 4
_file$ = 8						; size = 4
_type$ = 12						; size = 4
?aviIndexFlushSuper@@YAXPAUAVI_FILE@@W4stream_t@@@Z PROC ; aviIndexFlushSuper, COMDAT

; 49   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 10	 sub	 esp, 16			; 00000010H
  00006	56		 push	 esi

; 50   :     STREAM_SUPER_INDEX *index;
; 51   :     int64              offset;
; 52   : 
; 53   :     index = &file->superIndex[type];

  00007	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  0000a	69 c0 28 04 00
	00		 imul	 eax, 1064		; 00000428H
  00010	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00013	8d 94 01 58 14
	00 00		 lea	 edx, DWORD PTR [ecx+eax+5208]
  0001a	89 55 fc	 mov	 DWORD PTR _index$[ebp], edx

; 54   : 
; 55   :     if (index->current <= 0)

  0001d	8b 45 fc	 mov	 eax, DWORD PTR _index$[ebp]
  00020	83 78 20 00	 cmp	 DWORD PTR [eax+32], 0
  00024	77 05		 ja	 SHORT $LN1@aviIndexFl

; 56   :        return;

  00026	e9 c1 00 00 00	 jmp	 $LN2@aviIndexFl
$LN1@aviIndexFl:

; 57   : 
; 58   :     offset = fileTell(file);

  0002b	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  0002e	51		 push	 ecx
  0002f	e8 00 00 00 00	 call	 ?fileTell@@YA_JPAUAVI_FILE@@@Z ; fileTell
  00034	83 c4 04	 add	 esp, 4
  00037	89 45 f0	 mov	 DWORD PTR _offset$[ebp], eax
  0003a	89 55 f4	 mov	 DWORD PTR _offset$[ebp+4], edx

; 59   : 
; 60   :     /* Update the number of super entries in use for this stream */
; 61   :     assert(index->header.nEntriesInUse < SUPER_INDEX_ENTRIES);
; 62   :     assert(index->header.nEntriesInUse + index->current <= SUPER_INDEX_ENTRIES);
; 63   : 
; 64   :     index->header.nEntriesInUse += index->current;

  0003d	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  00040	8b 42 0c	 mov	 eax, DWORD PTR [edx+12]
  00043	8b 4d fc	 mov	 ecx, DWORD PTR _index$[ebp]
  00046	03 41 20	 add	 eax, DWORD PTR [ecx+32]
  00049	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  0004c	89 42 0c	 mov	 DWORD PTR [edx+12], eax

; 65   :     fileSeek(file, index->offset + offsetof(AVISUPERINDEX, nEntriesInUse));

  0004f	8b 45 fc	 mov	 eax, DWORD PTR _index$[ebp]
  00052	8b 08		 mov	 ecx, DWORD PTR [eax]
  00054	83 c1 04	 add	 ecx, 4
  00057	8b 50 04	 mov	 edx, DWORD PTR [eax+4]
  0005a	83 d2 00	 adc	 edx, 0
  0005d	52		 push	 edx
  0005e	51		 push	 ecx
  0005f	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00062	50		 push	 eax
  00063	e8 00 00 00 00	 call	 ?fileSeek@@YAHPAUAVI_FILE@@_J@Z ; fileSeek
  00068	83 c4 0c	 add	 esp, 12			; 0000000cH

; 66   :     fileWrite(file, &index->header.nEntriesInUse,
; 67   :               sizeof(index->header.nEntriesInUse));

  0006b	6a 04		 push	 4
  0006d	8b 4d fc	 mov	 ecx, DWORD PTR _index$[ebp]
  00070	83 c1 0c	 add	 ecx, 12			; 0000000cH
  00073	51		 push	 ecx
  00074	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00077	52		 push	 edx
  00078	e8 00 00 00 00	 call	 ?fileWrite@@YAHPAUAVI_FILE@@PAXK@Z ; fileWrite
  0007d	83 c4 0c	 add	 esp, 12			; 0000000cH

; 68   : 
; 69   :     /* Add the new entries to the super index's array */
; 70   :     fileSeek(file, index->offset + sizeof(AVISUPERINDEX) +
; 71   :                       ((index->header.nEntriesInUse - index->current) *
; 72   :                        sizeof(AVISUPERINDEX_ENTRY)));

  00080	8b 45 fc	 mov	 eax, DWORD PTR _index$[ebp]
  00083	8b 08		 mov	 ecx, DWORD PTR [eax]
  00085	83 c1 18	 add	 ecx, 24			; 00000018H
  00088	8b 50 04	 mov	 edx, DWORD PTR [eax+4]
  0008b	83 d2 00	 adc	 edx, 0
  0008e	8b 45 fc	 mov	 eax, DWORD PTR _index$[ebp]
  00091	8b 75 fc	 mov	 esi, DWORD PTR _index$[ebp]
  00094	8b 40 0c	 mov	 eax, DWORD PTR [eax+12]
  00097	2b 46 20	 sub	 eax, DWORD PTR [esi+32]
  0009a	c1 e0 04	 shl	 eax, 4
  0009d	33 f6		 xor	 esi, esi
  0009f	03 c8		 add	 ecx, eax
  000a1	13 d6		 adc	 edx, esi
  000a3	52		 push	 edx
  000a4	51		 push	 ecx
  000a5	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000a8	51		 push	 ecx
  000a9	e8 00 00 00 00	 call	 ?fileSeek@@YAHPAUAVI_FILE@@_J@Z ; fileSeek
  000ae	83 c4 0c	 add	 esp, 12			; 0000000cH

; 73   :     fileWrite(file, index->entry, index->current *
; 74   :                                      sizeof(AVISUPERINDEX_ENTRY));

  000b1	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  000b4	8b 42 20	 mov	 eax, DWORD PTR [edx+32]
  000b7	c1 e0 04	 shl	 eax, 4
  000ba	50		 push	 eax
  000bb	8b 4d fc	 mov	 ecx, DWORD PTR _index$[ebp]
  000be	83 c1 24	 add	 ecx, 36			; 00000024H
  000c1	51		 push	 ecx
  000c2	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  000c5	52		 push	 edx
  000c6	e8 00 00 00 00	 call	 ?fileWrite@@YAHPAUAVI_FILE@@PAXK@Z ; fileWrite
  000cb	83 c4 0c	 add	 esp, 12			; 0000000cH

; 75   : 
; 76   :     fileSeek(file, offset);

  000ce	8b 45 f4	 mov	 eax, DWORD PTR _offset$[ebp+4]
  000d1	50		 push	 eax
  000d2	8b 4d f0	 mov	 ecx, DWORD PTR _offset$[ebp]
  000d5	51		 push	 ecx
  000d6	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  000d9	52		 push	 edx
  000da	e8 00 00 00 00	 call	 ?fileSeek@@YAHPAUAVI_FILE@@_J@Z ; fileSeek
  000df	83 c4 0c	 add	 esp, 12			; 0000000cH

; 77   : 
; 78   :     index->current = 0;

  000e2	8b 45 fc	 mov	 eax, DWORD PTR _index$[ebp]
  000e5	c7 40 20 00 00
	00 00		 mov	 DWORD PTR [eax+32], 0
$LN2@aviIndexFl:

; 79   : }

  000ec	5e		 pop	 esi
  000ed	8b e5		 mov	 esp, ebp
  000ef	5d		 pop	 ebp
  000f0	c3		 ret	 0
?aviIndexFlushSuper@@YAXPAUAVI_FILE@@W4stream_t@@@Z ENDP ; aviIndexFlushSuper
PUBLIC	?aviIndexAddSuperEntry@@YAXPAUAVI_FILE@@W4stream_t@@K_JK@Z ; aviIndexAddSuperEntry
; Function compile flags: /Odtp
;	COMDAT ?aviIndexAddSuperEntry@@YAXPAUAVI_FILE@@W4stream_t@@K_JK@Z
_TEXT	SEGMENT
_entry$ = -8						; size = 4
_index$ = -4						; size = 4
_file$ = 8						; size = 4
_type$ = 12						; size = 4
_duration$ = 16						; size = 4
_offset$ = 20						; size = 8
_size$ = 28						; size = 4
?aviIndexAddSuperEntry@@YAXPAUAVI_FILE@@W4stream_t@@K_JK@Z PROC ; aviIndexAddSuperEntry, COMDAT

; 195  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 08	 sub	 esp, 8

; 196  :     STREAM_SUPER_INDEX  *index;
; 197  :     AVISUPERINDEX_ENTRY *entry;
; 198  : 
; 199  :     index = &file->superIndex[type];

  00006	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  00009	69 c0 28 04 00
	00		 imul	 eax, 1064		; 00000428H
  0000f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00012	8d 94 01 58 14
	00 00		 lea	 edx, DWORD PTR [ecx+eax+5208]
  00019	89 55 fc	 mov	 DWORD PTR _index$[ebp], edx

; 200  : 
; 201  :     assert(index->current < MAX_SUPER_INDEX);
; 202  :     entry = &index->entry[index->current];

  0001c	8b 45 fc	 mov	 eax, DWORD PTR _index$[ebp]
  0001f	8b 48 20	 mov	 ecx, DWORD PTR [eax+32]
  00022	c1 e1 04	 shl	 ecx, 4
  00025	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  00028	8d 44 0a 24	 lea	 eax, DWORD PTR [edx+ecx+36]
  0002c	89 45 f8	 mov	 DWORD PTR _entry$[ebp], eax

; 203  : 
; 204  :     entry->dwDuration = duration;

  0002f	8b 4d f8	 mov	 ecx, DWORD PTR _entry$[ebp]
  00032	8b 55 10	 mov	 edx, DWORD PTR _duration$[ebp]
  00035	89 51 0c	 mov	 DWORD PTR [ecx+12], edx

; 205  :     entry->dwSize     = size;

  00038	8b 45 f8	 mov	 eax, DWORD PTR _entry$[ebp]
  0003b	8b 4d 1c	 mov	 ecx, DWORD PTR _size$[ebp]
  0003e	89 48 08	 mov	 DWORD PTR [eax+8], ecx

; 206  :     entry->qwOffset   = offset;

  00041	8b 55 f8	 mov	 edx, DWORD PTR _entry$[ebp]
  00044	8b 45 14	 mov	 eax, DWORD PTR _offset$[ebp]
  00047	89 02		 mov	 DWORD PTR [edx], eax
  00049	8b 4d 18	 mov	 ecx, DWORD PTR _offset$[ebp+4]
  0004c	89 4a 04	 mov	 DWORD PTR [edx+4], ecx

; 207  : 
; 208  :     index->current++;

  0004f	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  00052	8b 42 20	 mov	 eax, DWORD PTR [edx+32]
  00055	83 c0 01	 add	 eax, 1
  00058	8b 4d fc	 mov	 ecx, DWORD PTR _index$[ebp]
  0005b	89 41 20	 mov	 DWORD PTR [ecx+32], eax

; 209  :     if (index->current >= MAX_SUPER_INDEX)

  0005e	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  00061	83 7a 20 40	 cmp	 DWORD PTR [edx+32], 64	; 00000040H
  00065	72 10		 jb	 SHORT $LN2@aviIndexAd

; 210  :     {
; 211  :         /* Write the super index into the file */
; 212  :         aviIndexFlushSuper(file, type);

  00067	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  0006a	50		 push	 eax
  0006b	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  0006e	51		 push	 ecx
  0006f	e8 00 00 00 00	 call	 ?aviIndexFlushSuper@@YAXPAUAVI_FILE@@W4stream_t@@@Z ; aviIndexFlushSuper
  00074	83 c4 08	 add	 esp, 8
$LN2@aviIndexAd:

; 213  :     }
; 214  : }

  00077	8b e5		 mov	 esp, ebp
  00079	5d		 pop	 ebp
  0007a	c3		 ret	 0
?aviIndexAddSuperEntry@@YAXPAUAVI_FILE@@W4stream_t@@K_JK@Z ENDP ; aviIndexAddSuperEntry
_TEXT	ENDS
PUBLIC	?aviWriteInitialSuperIndex@@YAXPAUAVI_FILE@@W4stream_t@@@Z ; aviWriteInitialSuperIndex
; Function compile flags: /Odtp
;	COMDAT ?aviWriteInitialSuperIndex@@YAXPAUAVI_FILE@@W4stream_t@@@Z
_TEXT	SEGMENT
_index$ = -8						; size = 4
_cc$ = -4						; size = 4
_file$ = 8						; size = 4
_type$ = 12						; size = 4
?aviWriteInitialSuperIndex@@YAXPAUAVI_FILE@@W4stream_t@@@Z PROC ; aviWriteInitialSuperIndex, COMDAT

; 21   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 08	 sub	 esp, 8

; 22   :     STREAM_SUPER_INDEX *index;
; 23   :     STREAM_CC          *cc;
; 24   : 
; 25   :     index = &file->superIndex[type];

  00006	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  00009	69 c0 28 04 00
	00		 imul	 eax, 1064		; 00000428H
  0000f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00012	8d 94 01 58 14
	00 00		 lea	 edx, DWORD PTR [ecx+eax+5208]
  00019	89 55 f8	 mov	 DWORD PTR _index$[ebp], edx

; 26   :     cc    = aviGetStreamCC(file, type);

  0001c	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  0001f	50		 push	 eax
  00020	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00023	51		 push	 ecx
  00024	e8 00 00 00 00	 call	 ?aviGetStreamCC@@YAPAUSTREAM_CC@@PAUAVI_FILE@@W4stream_t@@@Z ; aviGetStreamCC
  00029	83 c4 08	 add	 esp, 8
  0002c	89 45 fc	 mov	 DWORD PTR _cc$[ebp], eax

; 27   : 
; 28   :     /* Get the offset to the beginning of the super index */
; 29   :     index->offset = fileTell(file);

  0002f	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00032	52		 push	 edx
  00033	e8 00 00 00 00	 call	 ?fileTell@@YA_JPAUAVI_FILE@@@Z ; fileTell
  00038	83 c4 04	 add	 esp, 4
  0003b	8b 4d f8	 mov	 ecx, DWORD PTR _index$[ebp]
  0003e	89 01		 mov	 DWORD PTR [ecx], eax
  00040	89 51 04	 mov	 DWORD PTR [ecx+4], edx

; 30   : 
; 31   :     /* Set the correct cc for the index and start with no entries in use */
; 32   :     index->header.dwChunkId = cc->data;

  00043	8b 55 f8	 mov	 edx, DWORD PTR _index$[ebp]
  00046	8b 45 fc	 mov	 eax, DWORD PTR _cc$[ebp]
  00049	8b 08		 mov	 ecx, DWORD PTR [eax]
  0004b	89 4a 10	 mov	 DWORD PTR [edx+16], ecx

; 33   : 
; 34   :     index->header.nEntriesInUse = 0;

  0004e	8b 55 f8	 mov	 edx, DWORD PTR _index$[ebp]
  00051	c7 42 0c 00 00
	00 00		 mov	 DWORD PTR [edx+12], 0

; 35   : 
; 36   :     /* Write the header */
; 37   :     fileWrite(file, &index->header, sizeof(AVISUPERINDEX));

  00058	6a 18		 push	 24			; 00000018H
  0005a	8b 45 f8	 mov	 eax, DWORD PTR _index$[ebp]
  0005d	83 c0 08	 add	 eax, 8
  00060	50		 push	 eax
  00061	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00064	51		 push	 ecx
  00065	e8 00 00 00 00	 call	 ?fileWrite@@YAHPAUAVI_FILE@@PAXK@Z ; fileWrite
  0006a	83 c4 0c	 add	 esp, 12			; 0000000cH

; 38   : 
; 39   :     /* Reserve space for a predefined number of entries */
; 40   :     fileReserveSpace(file, SUPER_INDEX_ENTRIES * sizeof(AVISUPERINDEX_ENTRY));

  0006d	68 00 00 04 00	 push	 262144			; 00040000H
  00072	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00075	52		 push	 edx
  00076	e8 00 00 00 00	 call	 ?fileReserveSpace@@YAHPAUAVI_FILE@@K@Z ; fileReserveSpace
  0007b	83 c4 08	 add	 esp, 8

; 41   : }

  0007e	8b e5		 mov	 esp, ebp
  00080	5d		 pop	 ebp
  00081	c3		 ret	 0
?aviWriteInitialSuperIndex@@YAXPAUAVI_FILE@@W4stream_t@@@Z ENDP ; aviWriteInitialSuperIndex
PUBLIC	?aviIndexFlushStd@@YAXPAUAVI_FILE@@W4stream_t@@@Z ; aviIndexFlushStd
; Function compile flags: /Odtp
;	COMDAT ?aviIndexFlushStd@@YAXPAUAVI_FILE@@W4stream_t@@@Z
_TEXT	SEGMENT
_header$ = -44						; size = 24
_size$ = -20						; size = 4
_index$ = -16						; size = 4
_cc$ = -12						; size = 4
_begin$ = -8						; size = 8
_file$ = 8						; size = 4
_type$ = 12						; size = 4
?aviIndexFlushStd@@YAXPAUAVI_FILE@@W4stream_t@@@Z PROC	; aviIndexFlushStd, COMDAT

; 87   : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 2c	 sub	 esp, 44			; 0000002cH

; 88   :     AVISTDINDEX      header;
; 89   :     STREAM_STD_INDEX *index;
; 90   :     STREAM_CC        *cc;
; 91   :     int64            begin;
; 92   :     DWORD            size;
; 93   : 
; 94   :     index = &file->stdIndex[type];

  00006	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  00009	69 c0 08 08 00
	00		 imul	 eax, 2056		; 00000808H
  0000f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00012	8d 94 01 48 04
	00 00		 lea	 edx, DWORD PTR [ecx+eax+1096]
  00019	89 55 f0	 mov	 DWORD PTR _index$[ebp], edx

; 95   : 
; 96   :     if (index->current <= 0)

  0001c	8b 45 f0	 mov	 eax, DWORD PTR _index$[ebp]
  0001f	83 78 04 00	 cmp	 DWORD PTR [eax+4], 0
  00023	77 05		 ja	 SHORT $LN1@aviIndexFl@2

; 97   :        return;

  00025	e9 eb 00 00 00	 jmp	 $LN2@aviIndexFl@2
$LN1@aviIndexFl@2:

; 98   : 
; 99   :     cc    = aviGetStreamCC(file, type);

  0002a	8b 4d 0c	 mov	 ecx, DWORD PTR _type$[ebp]
  0002d	51		 push	 ecx
  0002e	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00031	52		 push	 edx
  00032	e8 00 00 00 00	 call	 ?aviGetStreamCC@@YAPAUSTREAM_CC@@PAUAVI_FILE@@W4stream_t@@@Z ; aviGetStreamCC
  00037	83 c4 08	 add	 esp, 8
  0003a	89 45 f4	 mov	 DWORD PTR _cc$[ebp], eax

; 100  :     begin = fileTell(file);

  0003d	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00040	50		 push	 eax
  00041	e8 00 00 00 00	 call	 ?fileTell@@YA_JPAUAVI_FILE@@@Z ; fileTell
  00046	83 c4 04	 add	 esp, 4
  00049	89 45 f8	 mov	 DWORD PTR _begin$[ebp], eax
  0004c	89 55 fc	 mov	 DWORD PTR _begin$[ebp+4], edx

; 101  : 
; 102  :     aviBeginChunk(file, cc->index);

  0004f	8b 4d f4	 mov	 ecx, DWORD PTR _cc$[ebp]
  00052	8b 51 04	 mov	 edx, DWORD PTR [ecx+4]
  00055	52		 push	 edx
  00056	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00059	50		 push	 eax
  0005a	e8 00 00 00 00	 call	 ?aviBeginChunk@@YAXPAUAVI_FILE@@K@Z ; aviBeginChunk
  0005f	83 c4 08	 add	 esp, 8

; 103  :     header.wLongsPerEntry = 2;

  00062	b9 02 00 00 00	 mov	 ecx, 2
  00067	66 89 4d d4	 mov	 WORD PTR _header$[ebp], cx

; 104  :     header.bIndexSubType  = 0;

  0006b	c6 45 d6 00	 mov	 BYTE PTR _header$[ebp+2], 0

; 105  :     header.bIndexType     = AVI_INDEX_OF_CHUNKS;

  0006f	c6 45 d7 01	 mov	 BYTE PTR _header$[ebp+3], 1

; 106  :     header.nEntriesInUse  = index->current;

  00073	8b 55 f0	 mov	 edx, DWORD PTR _index$[ebp]
  00076	8b 42 04	 mov	 eax, DWORD PTR [edx+4]
  00079	89 45 d8	 mov	 DWORD PTR _header$[ebp+4], eax

; 107  :     header.dwChunkId      = cc->data;

  0007c	8b 4d f4	 mov	 ecx, DWORD PTR _cc$[ebp]
  0007f	8b 11		 mov	 edx, DWORD PTR [ecx]
  00081	89 55 dc	 mov	 DWORD PTR _header$[ebp+8], edx

; 108  :     header.qwBaseOffset   = aviGetBaseOffset(file, MOVI_BASE);

  00084	6a 01		 push	 1
  00086	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00089	50		 push	 eax
  0008a	e8 00 00 00 00	 call	 ?aviGetBaseOffset@@YA_JPAUAVI_FILE@@H@Z ; aviGetBaseOffset
  0008f	83 c4 08	 add	 esp, 8
  00092	89 45 e0	 mov	 DWORD PTR _header$[ebp+12], eax
  00095	89 55 e4	 mov	 DWORD PTR _header$[ebp+16], edx

; 109  :     header.dwReserved     = 0;

  00098	c7 45 e8 00 00
	00 00		 mov	 DWORD PTR _header$[ebp+20], 0

; 110  : 
; 111  :     fileWrite(file, &header, sizeof(AVISTDINDEX));

  0009f	6a 18		 push	 24			; 00000018H
  000a1	8d 4d d4	 lea	 ecx, DWORD PTR _header$[ebp]
  000a4	51		 push	 ecx
  000a5	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  000a8	52		 push	 edx
  000a9	e8 00 00 00 00	 call	 ?fileWrite@@YAHPAUAVI_FILE@@PAXK@Z ; fileWrite
  000ae	83 c4 0c	 add	 esp, 12			; 0000000cH

; 112  :     fileWrite(file, index->entry,
; 113  :               index->current * sizeof(AVISTDINDEX_ENTRY));

  000b1	8b 45 f0	 mov	 eax, DWORD PTR _index$[ebp]
  000b4	8b 48 04	 mov	 ecx, DWORD PTR [eax+4]
  000b7	c1 e1 03	 shl	 ecx, 3
  000ba	51		 push	 ecx
  000bb	8b 55 f0	 mov	 edx, DWORD PTR _index$[ebp]
  000be	83 c2 08	 add	 edx, 8
  000c1	52		 push	 edx
  000c2	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  000c5	50		 push	 eax
  000c6	e8 00 00 00 00	 call	 ?fileWrite@@YAHPAUAVI_FILE@@PAXK@Z ; fileWrite
  000cb	83 c4 0c	 add	 esp, 12			; 0000000cH

; 114  : 
; 115  :     size = aviEndChunk(file) + 8;

  000ce	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000d1	51		 push	 ecx
  000d2	e8 00 00 00 00	 call	 ?aviEndChunk@@YAKPAUAVI_FILE@@@Z ; aviEndChunk
  000d7	83 c4 04	 add	 esp, 4
  000da	83 c0 08	 add	 eax, 8
  000dd	89 45 ec	 mov	 DWORD PTR _size$[ebp], eax

; 116  : 
; 117  :     index->current = 0;

  000e0	8b 55 f0	 mov	 edx, DWORD PTR _index$[ebp]
  000e3	c7 42 04 00 00
	00 00		 mov	 DWORD PTR [edx+4], 0

; 118  : 
; 119  :     /* Add this chunk to the super index */
; 120  :     aviIndexAddSuperEntry(file, type, index->duration, begin, size);

  000ea	8b 45 ec	 mov	 eax, DWORD PTR _size$[ebp]
  000ed	50		 push	 eax
  000ee	8b 4d fc	 mov	 ecx, DWORD PTR _begin$[ebp+4]
  000f1	51		 push	 ecx
  000f2	8b 55 f8	 mov	 edx, DWORD PTR _begin$[ebp]
  000f5	52		 push	 edx
  000f6	8b 45 f0	 mov	 eax, DWORD PTR _index$[ebp]
  000f9	8b 08		 mov	 ecx, DWORD PTR [eax]
  000fb	51		 push	 ecx
  000fc	8b 55 0c	 mov	 edx, DWORD PTR _type$[ebp]
  000ff	52		 push	 edx
  00100	8b 45 08	 mov	 eax, DWORD PTR _file$[ebp]
  00103	50		 push	 eax
  00104	e8 00 00 00 00	 call	 ?aviIndexAddSuperEntry@@YAXPAUAVI_FILE@@W4stream_t@@K_JK@Z ; aviIndexAddSuperEntry
  00109	83 c4 18	 add	 esp, 24			; 00000018H

; 121  : 
; 122  :     index->duration = 0;

  0010c	8b 4d f0	 mov	 ecx, DWORD PTR _index$[ebp]
  0010f	c7 01 00 00 00
	00		 mov	 DWORD PTR [ecx], 0
$LN2@aviIndexFl@2:

; 123  : }

  00115	8b e5		 mov	 esp, ebp
  00117	5d		 pop	 ebp
  00118	c3		 ret	 0
?aviIndexFlushStd@@YAXPAUAVI_FILE@@W4stream_t@@@Z ENDP	; aviIndexFlushStd
PUBLIC	?aviIndexAddEntry@@YAXPAUAVI_FILE@@W4stream_t@@_JKKH@Z ; aviIndexAddEntry
; Function compile flags: /Odtp
;	COMDAT ?aviIndexAddEntry@@YAXPAUAVI_FILE@@W4stream_t@@_JKKH@Z
_TEXT	SEGMENT
_entry$ = -8						; size = 4
_index$ = -4						; size = 4
_file$ = 8						; size = 4
_type$ = 12						; size = 4
_begin$ = 16						; size = 8
_size$ = 24						; size = 4
_duration$ = 28						; size = 4
_keyFrame$ = 32						; size = 4
?aviIndexAddEntry@@YAXPAUAVI_FILE@@W4stream_t@@_JKKH@Z PROC ; aviIndexAddEntry, COMDAT

; 154  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 08	 sub	 esp, 8

; 155  :     STREAM_STD_INDEX  *index;
; 156  :     AVISTDINDEX_ENTRY *entry;
; 157  : 
; 158  :     index = &file->stdIndex[type];

  00006	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  00009	69 c0 08 08 00
	00		 imul	 eax, 2056		; 00000808H
  0000f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00012	8d 94 01 48 04
	00 00		 lea	 edx, DWORD PTR [ecx+eax+1096]
  00019	89 55 fc	 mov	 DWORD PTR _index$[ebp], edx

; 159  : 
; 160  :     /* Add this index to the count of indices for this stream */
; 161  :     file->stdIndexCount[type]++;

  0001c	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  0001f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00022	8b 94 81 40 04
	00 00		 mov	 edx, DWORD PTR [ecx+eax*4+1088]
  00029	83 c2 01	 add	 edx, 1
  0002c	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  0002f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00032	89 94 81 40 04
	00 00		 mov	 DWORD PTR [ecx+eax*4+1088], edx

; 162  : 
; 163  :     /* Update the length of the current set of indices */
; 164  :     index->duration += duration;

  00039	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  0003c	8b 02		 mov	 eax, DWORD PTR [edx]
  0003e	03 45 1c	 add	 eax, DWORD PTR _duration$[ebp]
  00041	8b 4d fc	 mov	 ecx, DWORD PTR _index$[ebp]
  00044	89 01		 mov	 DWORD PTR [ecx], eax

; 165  : 
; 166  :     assert(index->current < MAX_STD_INDEX);
; 167  :     entry = &index->entry[index->current];

  00046	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  00049	8b 42 04	 mov	 eax, DWORD PTR [edx+4]
  0004c	8b 4d fc	 mov	 ecx, DWORD PTR _index$[ebp]
  0004f	8d 54 c1 08	 lea	 edx, DWORD PTR [ecx+eax*8+8]
  00053	89 55 f8	 mov	 DWORD PTR _entry$[ebp], edx

; 168  : 
; 169  :     if (type==VIDEO_STREAM && !keyFrame)

  00056	83 7d 0c 00	 cmp	 DWORD PTR _type$[ebp], 0
  0005a	75 11		 jne	 SHORT $LN2@aviIndexAd@2
  0005c	83 7d 20 00	 cmp	 DWORD PTR _keyFrame$[ebp], 0
  00060	75 0b		 jne	 SHORT $LN2@aviIndexAd@2

; 170  :        size |= 0x80000000;

  00062	8b 45 18	 mov	 eax, DWORD PTR _size$[ebp]
  00065	0d 00 00 00 80	 or	 eax, -2147483648	; 80000000H
  0006a	89 45 18	 mov	 DWORD PTR _size$[ebp], eax
$LN2@aviIndexAd@2:

; 171  : 
; 172  :     /* Make a relative offset */
; 173  :     entry->dwOffset = (DWORD)(begin - aviGetBaseOffset(file, MOVI_BASE));

  0006d	6a 01		 push	 1
  0006f	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  00072	51		 push	 ecx
  00073	e8 00 00 00 00	 call	 ?aviGetBaseOffset@@YA_JPAUAVI_FILE@@H@Z ; aviGetBaseOffset
  00078	83 c4 08	 add	 esp, 8
  0007b	8b 4d 10	 mov	 ecx, DWORD PTR _begin$[ebp]
  0007e	2b c8		 sub	 ecx, eax
  00080	8b 45 14	 mov	 eax, DWORD PTR _begin$[ebp+4]
  00083	1b c2		 sbb	 eax, edx
  00085	8b 55 f8	 mov	 edx, DWORD PTR _entry$[ebp]
  00088	89 0a		 mov	 DWORD PTR [edx], ecx

; 174  : 
; 175  :     entry->dwSize = size;

  0008a	8b 45 f8	 mov	 eax, DWORD PTR _entry$[ebp]
  0008d	8b 4d 18	 mov	 ecx, DWORD PTR _size$[ebp]
  00090	89 48 04	 mov	 DWORD PTR [eax+4], ecx

; 176  : 
; 177  :     index->current++;

  00093	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  00096	8b 42 04	 mov	 eax, DWORD PTR [edx+4]
  00099	83 c0 01	 add	 eax, 1
  0009c	8b 4d fc	 mov	 ecx, DWORD PTR _index$[ebp]
  0009f	89 41 04	 mov	 DWORD PTR [ecx+4], eax

; 178  :     if (index->current >= MAX_STD_INDEX)

  000a2	8b 55 fc	 mov	 edx, DWORD PTR _index$[ebp]
  000a5	81 7a 04 00 01
	00 00		 cmp	 DWORD PTR [edx+4], 256	; 00000100H
  000ac	72 10		 jb	 SHORT $LN3@aviIndexAd@2

; 179  :     {
; 180  :         /* Write the index to the file */
; 181  :         aviIndexFlushStd(file, type);

  000ae	8b 45 0c	 mov	 eax, DWORD PTR _type$[ebp]
  000b1	50		 push	 eax
  000b2	8b 4d 08	 mov	 ecx, DWORD PTR _file$[ebp]
  000b5	51		 push	 ecx
  000b6	e8 00 00 00 00	 call	 ?aviIndexFlushStd@@YAXPAUAVI_FILE@@W4stream_t@@@Z ; aviIndexFlushStd
  000bb	83 c4 08	 add	 esp, 8
$LN3@aviIndexAd@2:

; 182  :     }
; 183  : }

  000be	8b e5		 mov	 esp, ebp
  000c0	5d		 pop	 ebp
  000c1	c3		 ret	 0
?aviIndexAddEntry@@YAXPAUAVI_FILE@@W4stream_t@@_JKKH@Z ENDP ; aviIndexAddEntry
_TEXT	ENDS
PUBLIC	?aviIndexFlush@@YAXPAUAVI_FILE@@@Z		; aviIndexFlush
; Function compile flags: /Odtp
;	COMDAT ?aviIndexFlush@@YAXPAUAVI_FILE@@@Z
_TEXT	SEGMENT
_i$ = -4						; size = 4
_file$ = 8						; size = 4
?aviIndexFlush@@YAXPAUAVI_FILE@@@Z PROC			; aviIndexFlush, COMDAT

; 130  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx

; 131  :     int i;
; 132  : 
; 133  :     /* Write data that's most likely closest to the current write position */
; 134  :     for (i = 0; i < NUM_STREAMS; i++)

  00004	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR _i$[ebp], 0
  0000b	eb 09		 jmp	 SHORT $LN6@aviIndexFl@3
$LN5@aviIndexFl@3:
  0000d	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  00010	83 c0 01	 add	 eax, 1
  00013	89 45 fc	 mov	 DWORD PTR _i$[ebp], eax
$LN6@aviIndexFl@3:
  00016	83 7d fc 02	 cmp	 DWORD PTR _i$[ebp], 2
  0001a	7d 12		 jge	 SHORT $LN4@aviIndexFl@3

; 135  :         aviIndexFlushStd(file, (stream_t)i);

  0001c	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  0001f	51		 push	 ecx
  00020	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  00023	52		 push	 edx
  00024	e8 00 00 00 00	 call	 ?aviIndexFlushStd@@YAXPAUAVI_FILE@@W4stream_t@@@Z ; aviIndexFlushStd
  00029	83 c4 08	 add	 esp, 8
  0002c	eb df		 jmp	 SHORT $LN5@aviIndexFl@3
$LN4@aviIndexFl@3:

; 136  : 
; 137  :     /* Write data that's closer to the beginning of the file */
; 138  :     for (i = 0; i < NUM_STREAMS; i++)

  0002e	c7 45 fc 00 00
	00 00		 mov	 DWORD PTR _i$[ebp], 0
  00035	eb 09		 jmp	 SHORT $LN3@aviIndexFl@3
$LN2@aviIndexFl@3:
  00037	8b 45 fc	 mov	 eax, DWORD PTR _i$[ebp]
  0003a	83 c0 01	 add	 eax, 1
  0003d	89 45 fc	 mov	 DWORD PTR _i$[ebp], eax
$LN3@aviIndexFl@3:
  00040	83 7d fc 02	 cmp	 DWORD PTR _i$[ebp], 2
  00044	7d 12		 jge	 SHORT $LN7@aviIndexFl@3

; 139  :         aviIndexFlushSuper(file, (stream_t)i);

  00046	8b 4d fc	 mov	 ecx, DWORD PTR _i$[ebp]
  00049	51		 push	 ecx
  0004a	8b 55 08	 mov	 edx, DWORD PTR _file$[ebp]
  0004d	52		 push	 edx
  0004e	e8 00 00 00 00	 call	 ?aviIndexFlushSuper@@YAXPAUAVI_FILE@@W4stream_t@@@Z ; aviIndexFlushSuper
  00053	83 c4 08	 add	 esp, 8
  00056	eb df		 jmp	 SHORT $LN2@aviIndexFl@3
$LN7@aviIndexFl@3:

; 140  : }

  00058	8b e5		 mov	 esp, ebp
  0005a	5d		 pop	 ebp
  0005b	c3		 ret	 0
?aviIndexFlush@@YAXPAUAVI_FILE@@@Z ENDP			; aviIndexFlush
END
