Showing error 39

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: ntdrivers-simplified/floppy_simpl4_BUG.cil.c
Line in file: 2156
Project: SV-COMP 2012
Tools: Manual Work
Entered: 2012-11-19 13:47:39 UTC


Source:

   1int FloppyThread  ;
   2int KernelMode  ;
   3int Suspended  ;
   4int Executive  ;
   5int DiskController  ;
   6int FloppyDiskPeripheral  ;
   7int FlConfigCallBack  ;
   8int MaximumInterfaceType  ;
   9int MOUNTDEV_MOUNTED_DEVICE_GUID  ;
  10int myStatus  ;
  11int s  ;
  12int UNLOADED  ;
  13int NP  ;
  14int DC  ;
  15int SKIP1  ;
  16int SKIP2  ;
  17int MPR1  ;
  18int MPR3  ;
  19int IPC  ;
  20int pended  ;
  21int compRegistered  ;
  22int lowerDriverReturn  ;
  23int setEventCalled  ;
  24int customIrp  ;
  25
  26void _BLAST_init(void) 
  27{ 
  28
  29  {
  30#line 75
  31  UNLOADED = 0;
  32#line 76
  33  NP = 1;
  34#line 77
  35  DC = 2;
  36#line 78
  37  SKIP1 = 3;
  38#line 79
  39  SKIP2 = 4;
  40#line 80
  41  MPR1 = 5;
  42#line 81
  43  MPR3 = 6;
  44#line 82
  45  IPC = 7;
  46#line 83
  47  s = UNLOADED;
  48#line 84
  49  pended = 0;
  50#line 85
  51  compRegistered = 0;
  52#line 86
  53  lowerDriverReturn = 0;
  54#line 87
  55  setEventCalled = 0;
  56#line 88
  57  customIrp = 0;
  58#line 89
  59  return;
  60}
  61}
  62#line 92 "floppy_simpl4.cil.c"
  63int PagingReferenceCount  =    0;
  64#line 93 "floppy_simpl4.cil.c"
  65int PagingMutex  =    0;
  66#line 94 "floppy_simpl4.cil.c"
  67int FlAcpiConfigureFloppy(int DisketteExtension , int FdcInfo ) 
  68{ 
  69
  70  {
  71#line 98
  72  return (0);
  73}
  74}
  75#line 101 "floppy_simpl4.cil.c"
  76int FlQueueIrpToThread(int Irp , int DisketteExtension ) 
  77{ int status ;
  78  int threadHandle ;
  79  int DisketteExtension__PoweringDown ;
  80  int DisketteExtension__ThreadReferenceCount ;
  81  int DisketteExtension__FloppyThread ;
  82  int Irp__IoStatus__Status ;
  83  int Irp__IoStatus__Information ;
  84  int Irp__Tail__Overlay__CurrentStackLocation__Control ;
  85  int ObjAttributes ;
  86  int __cil_tmp12 ;
  87  int __cil_tmp13 ;
  88
  89  {
  90#line 113
  91  if (DisketteExtension__PoweringDown == 1) {
  92#line 114
  93    myStatus = -1073741101;
  94#line 115
  95    Irp__IoStatus__Status = -1073741101;
  96#line 116
  97    Irp__IoStatus__Information = 0;
  98#line 117
  99    return (-1073741101);
 100  }
 101#line 121
 102  DisketteExtension__ThreadReferenceCount ++;
 103#line 122
 104  if (DisketteExtension__ThreadReferenceCount == 0) {
 105#line 123
 106    DisketteExtension__ThreadReferenceCount ++;
 107#line 124
 108    PagingReferenceCount ++;
 109#line 125
 110    if (PagingReferenceCount == 1) {
 111
 112    }
 113    {
 114#line 131
 115    status = PsCreateSystemThread(threadHandle, 0, ObjAttributes, 0, 0, FloppyThread,
 116                                  DisketteExtension);
 117    }
 118    {
 119#line 134
 120#line 134
 121    if (status < 0) {
 122#line 135
 123      DisketteExtension__ThreadReferenceCount = -1;
 124#line 136
 125      PagingReferenceCount --;
 126#line 137
 127      if (PagingReferenceCount == 0) {
 128
 129      }
 130#line 142
 131      return (status);
 132    }
 133    }
 134    {
 135#line 147
 136    status = ObReferenceObjectByHandle(threadHandle, 1048576, 0, KernelMode, DisketteExtension__FloppyThread,
 137                                       0);
 138#line 149
 139    ZwClose(threadHandle);
 140    }
 141    {
 142#line 151
 143#line 151
 144    if (status < 0) {
 145#line 152
 146      return (status);
 147    }
 148    }
 149  }
 150#line 159
 151  //Irp__Tail__Overlay__CurrentStackLocation__Control |= 1;
 152#line 160
 153  if (pended == 0) {
 154#line 161
 155    pended = 1;
 156  } else {
 157    {
 158#line 164
 159    errorFn();
 160    }
 161  }
 162#line 167
 163  return (259);
 164}
 165}
 166#line 170 "floppy_simpl4.cil.c"
 167int FloppyPnp(int DeviceObject , int Irp ) 
 168{ int DeviceObject__DeviceExtension ;
 169  int Irp__Tail__Overlay__CurrentStackLocation ;
 170  int Irp__IoStatus__Information ;
 171  int Irp__IoStatus__Status ;
 172  int Irp__CurrentLocation ;
 173  int disketteExtension__IsRemoved ;
 174  int disketteExtension__IsStarted ;
 175  int disketteExtension__TargetObject ;
 176  int disketteExtension__HoldNewRequests ;
 177  int disketteExtension__FloppyThread ;
 178  int disketteExtension__InterfaceString__Buffer ;
 179  int disketteExtension__InterfaceString ;
 180  int disketteExtension__ArcName__Length ;
 181  int disketteExtension__ArcName ;
 182  int irpSp__MinorFunction ;
 183  int IoGetConfigurationInformation__FloppyCount ;
 184  int irpSp ;
 185  int disketteExtension ;
 186  int ntStatus ;
 187  int doneEvent ;
 188  int irpSp___0 ;
 189  int nextIrpSp ;
 190  int nextIrpSp__Control ;
 191  int irpSp___1 ;
 192  int irpSp__Context ;
 193  int irpSp__Control ;
 194  long __cil_tmp29 ;
 195  long __cil_tmp30 ;
 196
 197  {
 198#line 199
 199  ntStatus = 0;
 200#line 200
 201  PagingReferenceCount ++;
 202#line 201
 203  if (PagingReferenceCount == 1) {
 204
 205  }
 206#line 206
 207  disketteExtension = DeviceObject__DeviceExtension;
 208#line 207
 209  irpSp = Irp__Tail__Overlay__CurrentStackLocation;
 210#line 208
 211  if (disketteExtension__IsRemoved) {
 212    {
 213#line 210
 214    Irp__IoStatus__Information = 0;
 215#line 211
 216    Irp__IoStatus__Status = -1073741738;
 217#line 212
 218    myStatus = -1073741738;
 219#line 213
 220    IofCompleteRequest(Irp, 0);
 221    }
 222#line 215
 223    return (-1073741738);
 224  }
 225#line 219
 226  if (irpSp__MinorFunction == 0) {
 227    goto switch_0_0;
 228  } else {
 229#line 222
 230    if (irpSp__MinorFunction == 5) {
 231      goto switch_0_5;
 232    } else {
 233#line 225
 234      if (irpSp__MinorFunction == 1) {
 235        goto switch_0_5;
 236      } else {
 237#line 228
 238        if (irpSp__MinorFunction == 6) {
 239          goto switch_0_6;
 240        } else {
 241#line 231
 242          if (irpSp__MinorFunction == 3) {
 243            goto switch_0_6;
 244          } else {
 245#line 234
 246            if (irpSp__MinorFunction == 4) {
 247              goto switch_0_4;
 248            } else {
 249#line 237
 250              if (irpSp__MinorFunction == 2) {
 251                goto switch_0_2;
 252              } else {
 253                goto switch_0_default;
 254#line 242
 255                if (0) {
 256                  switch_0_0: 
 257                  {
 258#line 245
 259                  ntStatus = FloppyStartDevice(DeviceObject, Irp);
 260                  }
 261                  goto switch_0_break;
 262                  switch_0_5: 
 263#line 250
 264                  if (irpSp__MinorFunction == 5) {
 265
 266                  }
 267#line 255
 268                  if (! disketteExtension__IsStarted) {
 269#line 256
 270                    if (s == NP) {
 271#line 257
 272                      s = SKIP1;
 273                    } else {
 274                      {
 275#line 260
 276                      errorFn();
 277                      }
 278                    }
 279                    {
 280#line 264
 281                    Irp__CurrentLocation ++;
 282#line 265
 283                    Irp__Tail__Overlay__CurrentStackLocation ++;
 284#line 266
 285                    ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 286                    }
 287#line 268
 288                    return (ntStatus);
 289                  }
 290                  {
 291#line 273
 292                  disketteExtension__HoldNewRequests = 1;
 293#line 274
 294                  ntStatus = FlQueueIrpToThread(Irp, disketteExtension);
 295                  }
 296                  {
 297#line 276
 298                  __cil_tmp29 = (long )ntStatus;
 299#line 276
 300                  if (__cil_tmp29 == 259L) {
 301                    {
 302#line 278
 303                    KeWaitForSingleObject(disketteExtension__FloppyThread, Executive,
 304                                          KernelMode, 0, 0);
 305                    }
 306#line 281
 307                    if (disketteExtension__FloppyThread != 0) {
 308
 309                    }
 310#line 286
 311                    disketteExtension__FloppyThread = 0;
 312#line 287
 313                    Irp__IoStatus__Status = 0;
 314#line 288
 315                    myStatus = 0;
 316#line 289
 317                    if (s == NP) {
 318#line 290
 319                      s = SKIP1;
 320                    } else {
 321                      {
 322#line 293
 323                      errorFn();
 324                      }
 325                    }
 326                    {
 327#line 297
 328                    Irp__CurrentLocation ++;
 329#line 298
 330                    Irp__Tail__Overlay__CurrentStackLocation ++;
 331#line 299
 332                    ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 333                    }
 334                  } else {
 335                    {
 336#line 303
 337                    ntStatus = -1073741823;
 338#line 304
 339                    Irp__IoStatus__Status = ntStatus;
 340#line 305
 341                    myStatus = ntStatus;
 342#line 306
 343                    Irp__IoStatus__Information = 0;
 344#line 307
 345                    IofCompleteRequest(Irp, 0);
 346                    }
 347                  }
 348                  }
 349                  goto switch_0_break;
 350                  switch_0_6: 
 351#line 313
 352                  if (irpSp__MinorFunction == 6) {
 353
 354                  }
 355#line 318
 356                  if (! disketteExtension__IsStarted) {
 357#line 319
 358                    Irp__IoStatus__Status = 0;
 359#line 320
 360                    myStatus = 0;
 361#line 321
 362                    if (s == NP) {
 363#line 322
 364                      s = SKIP1;
 365                    } else {
 366                      {
 367#line 325
 368                      errorFn();
 369                      }
 370                    }
 371                    {
 372#line 329
 373                    Irp__CurrentLocation ++;
 374#line 330
 375                    Irp__Tail__Overlay__CurrentStackLocation ++;
 376#line 331
 377                    ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 378                    }
 379                  } else {
 380#line 334
 381                    Irp__IoStatus__Status = 0;
 382#line 335
 383                    myStatus = 0;
 384#line 336
 385                    irpSp___0 = Irp__Tail__Overlay__CurrentStackLocation;
 386#line 337
 387                    nextIrpSp = Irp__Tail__Overlay__CurrentStackLocation - 1;
 388#line 338
 389                    nextIrpSp__Control = 0;
 390#line 339
 391                    if (s != NP) {
 392                      {
 393#line 341
 394                      errorFn();
 395                      }
 396                    } else {
 397#line 344
 398                      if (compRegistered != 0) {
 399                        {
 400#line 346
 401                        errorFn();
 402                        }
 403                      } else {
 404#line 349
 405                        compRegistered = 1;
 406                      }
 407                    }
 408                    {
 409#line 353
 410                    irpSp___1 = Irp__Tail__Overlay__CurrentStackLocation - 1;
 411#line 354
 412                    irpSp__Context = doneEvent;
 413#line 355
 414                    irpSp__Control = 224;
 415#line 359
 416                    ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 417                    }
 418                    {
 419#line 361
 420                    __cil_tmp30 = (long )ntStatus;
 421#line 361
 422                    if (__cil_tmp30 == 259L) {
 423                      {
 424#line 363
 425                      KeWaitForSingleObject(doneEvent, Executive, KernelMode, 0, 0);
 426#line 364
 427                      ntStatus = myStatus;
 428                      }
 429                    }
 430                    }
 431                    {
 432#line 370
 433                    disketteExtension__HoldNewRequests = 0;
 434#line 371
 435                    Irp__IoStatus__Status = ntStatus;
 436#line 372
 437                    myStatus = ntStatus;
 438#line 373
 439                    Irp__IoStatus__Information = 0;
 440#line 374
 441                    IofCompleteRequest(Irp, 0);
 442                    }
 443                  }
 444                  goto switch_0_break;
 445                  switch_0_4: 
 446#line 379
 447                  disketteExtension__IsStarted = 0;
 448#line 380
 449                  Irp__IoStatus__Status = 0;
 450#line 381
 451                  myStatus = 0;
 452#line 382
 453                  if (s == NP) {
 454#line 383
 455                    s = SKIP1;
 456                  } else {
 457                    {
 458#line 386
 459                    errorFn();
 460                    }
 461                  }
 462                  {
 463#line 390
 464                  Irp__CurrentLocation ++;
 465#line 391
 466                  Irp__Tail__Overlay__CurrentStackLocation ++;
 467#line 392
 468                  ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 469                  }
 470                  goto switch_0_break;
 471                  switch_0_2: 
 472#line 396
 473                  disketteExtension__HoldNewRequests = 0;
 474#line 397
 475                  disketteExtension__IsStarted = 0;
 476#line 398
 477                  disketteExtension__IsRemoved = 1;
 478#line 399
 479                  if (s == NP) {
 480#line 400
 481                    s = SKIP1;
 482                  } else {
 483                    {
 484#line 403
 485                    errorFn();
 486                    }
 487                  }
 488                  {
 489#line 407
 490                  Irp__CurrentLocation ++;
 491#line 408
 492                  Irp__Tail__Overlay__CurrentStackLocation ++;
 493#line 409
 494                  Irp__IoStatus__Status = 0;
 495#line 410
 496                  myStatus = 0;
 497#line 411
 498                  ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 499                  }
 500#line 413
 501                  if (disketteExtension__InterfaceString__Buffer != 0) {
 502                    {
 503#line 415
 504                    IoSetDeviceInterfaceState(disketteExtension__InterfaceString,
 505                                              0);
 506                    }
 507                  }
 508#line 421
 509                  if (disketteExtension__ArcName__Length != 0) {
 510                    {
 511#line 423
 512                    IoDeleteSymbolicLink(disketteExtension__ArcName);
 513                    }
 514                  }
 515#line 428
 516                  IoGetConfigurationInformation__FloppyCount --;
 517                  goto switch_0_break;
 518                  switch_0_default: ;
 519#line 431
 520                  if (s == NP) {
 521#line 432
 522                    s = SKIP1;
 523                  } else {
 524                    {
 525#line 435
 526                    errorFn();
 527                    }
 528                  }
 529                  {
 530#line 439
 531                  Irp__CurrentLocation ++;
 532#line 440
 533                  Irp__Tail__Overlay__CurrentStackLocation ++;
 534#line 441
 535                  ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 536                  }
 537                } else {
 538                  switch_0_break: ;
 539                }
 540              }
 541            }
 542          }
 543        }
 544      }
 545    }
 546  }
 547#line 454
 548  PagingReferenceCount --;
 549#line 455
 550  if (PagingReferenceCount == 0) {
 551
 552  }
 553#line 460
 554  return (ntStatus);
 555}
 556}
 557#line 463 "floppy_simpl4.cil.c"
 558int FloppyStartDevice(int DeviceObject , int Irp ) 
 559{ int DeviceObject__DeviceExtension ;
 560  int Irp__Tail__Overlay__CurrentStackLocation ;
 561  int Irp__IoStatus__Status ;
 562  int disketteExtension__TargetObject ;
 563  int disketteExtension__MaxTransferSize ;
 564  int disketteExtension__DriveType ;
 565  int disketteExtension__PerpendicularMode ;
 566  int disketteExtension__DeviceUnit ;
 567  int disketteExtension__DriveOnValue ;
 568  int disketteExtension__UnderlyingPDO ;
 569  int disketteExtension__InterfaceString ;
 570  int disketteExtension__IsStarted ;
 571  int disketteExtension__HoldNewRequests ;
 572  int ntStatus ;
 573  int pnpStatus ;
 574  int doneEvent ;
 575  int fdcInfo ;
 576  int fdcInfo__BufferCount ;
 577  int fdcInfo__BufferSize ;
 578  int fdcInfo__MaxTransferSize ;
 579  int fdcInfo__AcpiBios ;
 580  int fdcInfo__AcpiFdiSupported ;
 581  int fdcInfo__PeripheralNumber ;
 582  int fdcInfo__BusType ;
 583  int fdcInfo__ControllerNumber ;
 584  int fdcInfo__UnitNumber ;
 585  int fdcInfo__BusNumber ;
 586  int Dc ;
 587  int Fp ;
 588  int disketteExtension ;
 589  int irpSp ;
 590  int irpSp___0 ;
 591  int nextIrpSp ;
 592  int nextIrpSp__Control ;
 593  int irpSp___1 ;
 594  int irpSp__Control ;
 595  int irpSp__Context ;
 596  int InterfaceType ;
 597  int KUSER_SHARED_DATA__AlternativeArchitecture_NEC98x86 ;
 598  long __cil_tmp42 ;
 599  int __cil_tmp43 ;
 600  int __cil_tmp44 ;
 601  int __cil_tmp45 ;
 602  int __cil_tmp46 ;
 603  int __cil_tmp47 ;
 604  int __cil_tmp48 ;
 605  int __cil_tmp49 ;
 606
 607  {
 608#line 505
 609  Dc = DiskController;
 610#line 506
 611  Fp = FloppyDiskPeripheral;
 612#line 507
 613  disketteExtension = DeviceObject__DeviceExtension;
 614#line 508
 615  irpSp = Irp__Tail__Overlay__CurrentStackLocation;
 616#line 509
 617  irpSp___0 = Irp__Tail__Overlay__CurrentStackLocation;
 618#line 510
 619  nextIrpSp = Irp__Tail__Overlay__CurrentStackLocation - 1;
 620#line 511
 621  nextIrpSp__Control = 0;
 622#line 512
 623  if (s != NP) {
 624    {
 625#line 514
 626    errorFn();
 627    }
 628  } else {
 629#line 517
 630    if (compRegistered != 0) {
 631      {
 632#line 519
 633      errorFn();
 634      }
 635    } else {
 636#line 522
 637      compRegistered = 1;
 638    }
 639  }
 640  {
 641#line 526
 642  irpSp___1 = Irp__Tail__Overlay__CurrentStackLocation - 1;
 643#line 527
 644  irpSp__Context = doneEvent;
 645#line 528
 646  irpSp__Control = 224;
 647#line 532
 648  ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
 649  }
 650  {
 651#line 534
 652  __cil_tmp42 = (long )ntStatus;
 653#line 534
 654  if (__cil_tmp42 == 259L) {
 655    {
 656#line 536
 657    ntStatus = KeWaitForSingleObject(doneEvent, Executive, KernelMode, 0, 0);
 658#line 537
 659    ntStatus = myStatus;
 660    }
 661  }
 662  }
 663  {
 664#line 543
 665  fdcInfo__BufferCount = 0;
 666#line 544
 667  fdcInfo__BufferSize = 0;
 668#line 545
 669  //__cil_tmp43 = 770 << 2;
 670#line 545
 671  //__cil_tmp44 = 7 << 16;
 672#line 545
 673  //__cil_tmp45 = __cil_tmp44 | __cil_tmp43;
 674#line 545
 675  //__cil_tmp46 = __cil_tmp45 | 3;
 676#line 545
 677  ntStatus = FlFdcDeviceIo(disketteExtension__TargetObject, __cil_tmp46, fdcInfo);
 678  }
 679#line 548
 680  if (ntStatus >= 0) {
 681#line 549
 682    disketteExtension__MaxTransferSize = fdcInfo__MaxTransferSize;
 683#line 550
 684    if (fdcInfo__AcpiBios) {
 685#line 551
 686      if (fdcInfo__AcpiFdiSupported) {
 687        {
 688#line 553
 689        ntStatus = FlAcpiConfigureFloppy(disketteExtension, fdcInfo);
 690        }
 691#line 555
 692        if (disketteExtension__DriveType == 4) {
 693#line 556
 694         // __cil_tmp47 = 1 << fdcInfo__PeripheralNumber;
 695#line 556
 696          //disketteExtension__PerpendicularMode |= __cil_tmp47;
 697        }
 698      } else {
 699        goto _L;
 700      }
 701    } else {
 702      _L: 
 703#line 565
 704      if (disketteExtension__DriveType == 4) {
 705#line 566
 706       // __cil_tmp48 = 1 << fdcInfo__PeripheralNumber;
 707#line 566
 708        //disketteExtension__PerpendicularMode |= __cil_tmp48;
 709      }
 710#line 570
 711      InterfaceType = 0;
 712      {
 713#line 572
 714      while (1) {
 715        while_0_continue: /* CIL Label */ ;
 716
 717#line 574
 718        if (InterfaceType >= MaximumInterfaceType) {
 719          goto while_1_break;
 720        }
 721        {
 722#line 580
 723        fdcInfo__BusType = InterfaceType;
 724#line 581
 725        ntStatus = IoQueryDeviceDescription(fdcInfo__BusType, fdcInfo__BusNumber,
 726                                            Dc, fdcInfo__ControllerNumber, Fp, fdcInfo__PeripheralNumber,
 727                                            FlConfigCallBack, disketteExtension);
 728        }
 729#line 585
 730        if (ntStatus >= 0) {
 731          goto while_1_break;
 732        }
 733#line 590
 734        InterfaceType ++;
 735      }
 736      while_0_break: /* CIL Label */ ;
 737      }
 738      while_1_break: ;
 739    }
 740#line 595
 741    if (ntStatus >= 0) {
 742#line 596
 743      if (KUSER_SHARED_DATA__AlternativeArchitecture_NEC98x86 != 0) {
 744#line 597
 745        disketteExtension__DeviceUnit = fdcInfo__UnitNumber;
 746#line 598
 747        disketteExtension__DriveOnValue = fdcInfo__UnitNumber;
 748      } else {
 749#line 600
 750        disketteExtension__DeviceUnit = fdcInfo__PeripheralNumber;
 751#line 601
 752        //__cil_tmp49 = 16 << fdcInfo__PeripheralNumber;
 753#line 601
 754        //disketteExtension__DriveOnValue = fdcInfo__PeripheralNumber | __cil_tmp49;
 755      }
 756      {
 757#line 604
 758      pnpStatus = IoRegisterDeviceInterface(disketteExtension__UnderlyingPDO, MOUNTDEV_MOUNTED_DEVICE_GUID,
 759                                            0, disketteExtension__InterfaceString);
 760      }
 761#line 607
 762      if (pnpStatus >= 0) {
 763        {
 764#line 609
 765        pnpStatus = IoSetDeviceInterfaceState(disketteExtension__InterfaceString,
 766                                              1);
 767        }
 768      }
 769#line 615
 770      disketteExtension__IsStarted = 1;
 771#line 616
 772      disketteExtension__HoldNewRequests = 0;
 773    }
 774  }
 775  {
 776#line 624
 777  Irp__IoStatus__Status = ntStatus;
 778#line 625
 779  myStatus = ntStatus;
 780#line 626
 781  IofCompleteRequest(Irp, 0);
 782  }
 783#line 628
 784  return (ntStatus);
 785}
 786}
 787#line 631 "floppy_simpl4.cil.c"
 788int FloppyPnpComplete(int DeviceObject , int Irp , int Context ) 
 789{ 
 790
 791  {
 792  {
 793#line 636
 794  KeSetEvent(Context, 1, 0);
 795  }
 796#line 638
 797  return (-1073741802);
 798}
 799}
 800#line 641 "floppy_simpl4.cil.c"
 801int FlFdcDeviceIo(int DeviceObject , int Ioctl , int Data ) 
 802{ int ntStatus ;
 803  int irp ;
 804  int irpStack ;
 805  int doneEvent ;
 806  int ioStatus ;
 807  int irp__Tail__Overlay__CurrentStackLocation ;
 808  int irpStack__Parameters__DeviceIoControl__Type3InputBuffer ;
 809  long __cil_tmp11 ;
 810
 811  {
 812  {
 813#line 652
 814  irp = IoBuildDeviceIoControlRequest(Ioctl, DeviceObject, 0, 0, 0, 0, 1, doneEvent,
 815                                      ioStatus);
 816  }
 817#line 655
 818  if (irp == 0) {
 819#line 656
 820    return (-1073741670);
 821  }
 822  {
 823#line 661
 824  irpStack = irp__Tail__Overlay__CurrentStackLocation - 1;
 825#line 662
 826  irpStack__Parameters__DeviceIoControl__Type3InputBuffer = Data;
 827#line 663
 828  ntStatus = IofCallDriver(DeviceObject, irp);
 829  }
 830  {
 831#line 665
 832  __cil_tmp11 = (long )ntStatus;
 833#line 665
 834  if (__cil_tmp11 == 259L) {
 835    {
 836#line 667
 837    KeWaitForSingleObject(doneEvent, Suspended, KernelMode, 0, 0);
 838#line 668
 839    ntStatus = myStatus;
 840    }
 841  }
 842  }
 843#line 673
 844  return (ntStatus);
 845}
 846}
 847#line 676 "floppy_simpl4.cil.c"
 848void FloppyProcessQueuedRequests(int DisketteExtension ) 
 849{ 
 850
 851  {
 852#line 680
 853  return;
 854}
 855}
 856#line 683 "floppy_simpl4.cil.c"
 857void stub_driver_init(void) 
 858{ 
 859
 860  {
 861#line 687
 862  s = NP;
 863#line 688
 864  pended = 0;
 865#line 689
 866  compRegistered = 0;
 867#line 690
 868  lowerDriverReturn = 0;
 869#line 691
 870  setEventCalled = 0;
 871#line 692
 872  customIrp = 0;
 873#line 693
 874  return;
 875}
 876}
 877#line 696 "floppy_simpl4.cil.c"
 878int main(void) 
 879{ int status ;
 880  int irp ;
 881  int pirp ;
 882  int pirp__IoStatus__Status ;
 883//  int __VERIFIER_nondet_int() ;
 884  int irp_choice ;
 885  int devobj ;
 886  int __cil_tmp8 ;
 887
 888 FloppyThread  = 0;
 889 KernelMode  = 0;
 890 Suspended  = 0;
 891 Executive  = 0;
 892 DiskController  = 0;
 893 FloppyDiskPeripheral  = 0;
 894 FlConfigCallBack  = 0;
 895 MaximumInterfaceType  = 0;
 896 MOUNTDEV_MOUNTED_DEVICE_GUID  = 0;
 897 myStatus  = 0;
 898 s  = 0;
 899 UNLOADED  = 0;
 900 NP  = 0;
 901 DC  = 0;
 902 SKIP1  = 0;
 903 SKIP2 = 0 ;
 904 MPR1  = 0;
 905 MPR3  = 0;
 906 IPC  = 0;
 907 pended  = 0;
 908 compRegistered  = 0;
 909 lowerDriverReturn  = 0;
 910 setEventCalled  = 0;
 911 customIrp  = 0;
 912
 913  {
 914  {
 915#line 707
 916  status = 0;
 917#line 708
 918  pirp = irp;
 919#line 709
 920  _BLAST_init();
 921  }
 922#line 711
 923  if (status >= 0) {
 924#line 712
 925    s = NP;
 926#line 713
 927    customIrp = 0;
 928#line 714
 929    setEventCalled = customIrp;
 930#line 715
 931    lowerDriverReturn = setEventCalled;
 932#line 716
 933    compRegistered = lowerDriverReturn;
 934#line 717
 935    pended = compRegistered;
 936#line 718
 937    pirp__IoStatus__Status = 0;
 938#line 719
 939    myStatus = 0;
 940#line 720
 941    if (irp_choice == 0) {
 942#line 721
 943      pirp__IoStatus__Status = -1073741637;
 944#line 722
 945      myStatus = -1073741637;
 946    }
 947    {
 948#line 727
 949    stub_driver_init();
 950    }
 951    {
 952#line 729
 953#line 729
 954    if (status < 0) {
 955#line 730
 956      return (-1);
 957    }
 958    }
 959#line 734
 960    int tmp_ndt_1;
 961    tmp_ndt_1 = __VERIFIER_nondet_int();
 962    if (tmp_ndt_1 == 0) {
 963      goto switch_2_0;
 964    } else {
 965#line 737
 966      int tmp_ndt_2;
 967      tmp_ndt_2 = __VERIFIER_nondet_int();
 968      if (tmp_ndt_2 == 1) {
 969        goto switch_2_1;
 970      } else {
 971#line 740
 972        int tmp_ndt_3;
 973        tmp_ndt_3 = __VERIFIER_nondet_int();
 974        if (tmp_ndt_3 == 2) {
 975          goto switch_2_2;
 976        } else {
 977#line 743
 978              int tmp_ndt_4;
 979          tmp_ndt_4 = __VERIFIER_nondet_int();
 980          if (tmp_ndt_4 == 3) {
 981            goto switch_2_3;
 982          } else {
 983            goto switch_2_default;
 984#line 748
 985            if (0) {
 986              switch_2_0: 
 987              {
 988#line 751
 989              status = FloppyCreateClose(devobj, pirp);
 990              }
 991              goto switch_2_break;
 992              switch_2_1: 
 993              {
 994#line 756
 995              status = FloppyCreateClose(devobj, pirp);
 996              }
 997              goto switch_2_break;
 998              switch_2_2: 
 999              {
1000#line 761
1001              status = FloppyDeviceControl(devobj, pirp);
1002              }
1003              goto switch_2_break;
1004              switch_2_3: 
1005              {
1006#line 766
1007              status = FloppyPnp(devobj, pirp);
1008              }
1009              goto switch_2_break;
1010              switch_2_default: ;
1011#line 770
1012              return (-1);
1013            } else {
1014              switch_2_break: ;
1015            }
1016          }
1017        }
1018      }
1019    }
1020  }
1021#line 782
1022  if (pended == 1) {
1023#line 783
1024    if (s == NP) {
1025#line 784
1026      s = NP;
1027    } else {
1028      goto _L___2;
1029    }
1030  } else {
1031    _L___2: 
1032#line 790
1033    if (pended == 1) {
1034#line 791
1035      if (s == MPR3) {
1036#line 792
1037        s = MPR3;
1038      } else {
1039        goto _L___1;
1040      }
1041    } else {
1042      _L___1: 
1043#line 798
1044      if (s != UNLOADED) {
1045#line 801
1046        if (status != -1) {
1047#line 804
1048          if (s != SKIP2) {
1049#line 805
1050            if (s != IPC) {
1051#line 806
1052              if (s != DC) {
1053                {
1054#line 808
1055                errorFn();
1056                }
1057              } else {
1058                goto _L___0;
1059              }
1060            } else {
1061              goto _L___0;
1062            }
1063          } else {
1064            _L___0: 
1065#line 818
1066            if (pended == 1) {
1067#line 819
1068              if (status != 259) {
1069#line 820
1070                errorFn();
1071              }
1072            } else {
1073#line 825
1074              if (s == DC) {
1075#line 826
1076                if (status == 259) {
1077                  {
1078#line 828
1079                  errorFn();
1080                  }
1081                }
1082              } else {
1083#line 834
1084                if (status != lowerDriverReturn) {
1085                  {
1086#line 836
1087                  errorFn();
1088                  }
1089                }
1090              }
1091            }
1092          }
1093        }
1094      }
1095    }
1096  }
1097#line 848
1098  status = 0;
1099#line 849
1100  return (status);
1101}
1102}
1103#line 852 "floppy_simpl4.cil.c"
1104int IoBuildDeviceIoControlRequest(int IoControlCode , int DeviceObject , int InputBuffer ,
1105                                  int InputBufferLength , int OutputBuffer , int OutputBufferLength ,
1106                                  int InternalDeviceIoControl , int Event , int IoStatusBlock ) 
1107{ //int __VERIFIER_nondet_int() ;
1108  int malloc ;
1109
1110  {
1111#line 859
1112  customIrp = 1;
1113#line 860
1114  int tmp_ndt_5;
1115  tmp_ndt_5 = __VERIFIER_nondet_int();
1116  if (tmp_ndt_5 == 0) {
1117    goto switch_3_0;
1118  } else {
1119    goto switch_3_default;
1120#line 865
1121    if (0) {
1122      switch_3_0: 
1123#line 867
1124      return (malloc);
1125      switch_3_default: ;
1126#line 869
1127      return (0);
1128    } else {
1129
1130    }
1131  }
1132}
1133}
1134#line 877 "floppy_simpl4.cil.c"
1135int IoDeleteSymbolicLink(int SymbolicLinkName ) 
1136{// int __VERIFIER_nondet_int() ;
1137
1138  {
1139#line 881
1140  int tmp_ndt_6;
1141  tmp_ndt_6 = __VERIFIER_nondet_int();
1142  if (tmp_ndt_6 == 0) {
1143    goto switch_4_0;
1144  } else {
1145    goto switch_4_default;
1146#line 886
1147    if (0) {
1148      switch_4_0: 
1149#line 888
1150      return (0);
1151      switch_4_default: ;
1152#line 890
1153      return (-1073741823);
1154    } else {
1155
1156    }
1157  }
1158}
1159}
1160#line 898 "floppy_simpl4.cil.c"
1161int IoQueryDeviceDescription(int BusType , int BusNumber , int ControllerType , int ControllerNumber ,
1162                             int PeripheralType , int PeripheralNumber , int CalloutRoutine ,
1163                             int Context ) 
1164{// int __VERIFIER_nondet_int() ;
1165
1166  {
1167#line 904
1168  int tmp_ndt_7;
1169  tmp_ndt_7 = __VERIFIER_nondet_int();
1170  if (tmp_ndt_7 == 0) {
1171    goto switch_5_0;
1172  } else {
1173    goto switch_5_default;
1174#line 909
1175    if (0) {
1176      switch_5_0: 
1177#line 911
1178      return (0);
1179      switch_5_default: ;
1180#line 913
1181      return (-1073741823);
1182    } else {
1183
1184    }
1185  }
1186}
1187}
1188#line 921 "floppy_simpl4.cil.c"
1189int IoRegisterDeviceInterface(int PhysicalDeviceObject , int InterfaceClassGuid ,
1190                              int ReferenceString , int SymbolicLinkName ) 
1191{// int __VERIFIER_nondet_int() ;
1192
1193  {
1194#line 926
1195  int tmp_ndt_8;
1196  tmp_ndt_8 = __VERIFIER_nondet_int();
1197  if (tmp_ndt_8 == 0) {
1198    goto switch_6_0;
1199  } else {
1200    goto switch_6_default;
1201#line 931
1202    if (0) {
1203      switch_6_0: 
1204#line 933
1205      return (0);
1206      switch_6_default: ;
1207#line 935
1208      return (-1073741808);
1209    } else {
1210
1211    }
1212  }
1213}
1214}
1215#line 943 "floppy_simpl4.cil.c"
1216int IoSetDeviceInterfaceState(int SymbolicLinkName , int Enable ) 
1217{ //int __VERIFIER_nondet_int() ;
1218
1219  {
1220#line 947
1221  int tmp_ndt_9;
1222  tmp_ndt_9 = __VERIFIER_nondet_int();
1223  if (tmp_ndt_9 == 0) {
1224    goto switch_7_0;
1225  } else {
1226    goto switch_7_default;
1227#line 952
1228    if (0) {
1229      switch_7_0: 
1230#line 954
1231      return (0);
1232      switch_7_default: ;
1233#line 956
1234      return (-1073741823);
1235    } else {
1236
1237    }
1238  }
1239}
1240}
1241#line 964 "floppy_simpl4.cil.c"
1242void stubMoreProcessingRequired(void) 
1243{ 
1244
1245  {
1246#line 968
1247  if (s == NP) {
1248#line 969
1249    s = MPR1;
1250  } else {
1251    {
1252#line 972
1253    errorFn();
1254    }
1255  }
1256#line 975
1257  return;
1258}
1259}
1260#line 978 "floppy_simpl4.cil.c"
1261int IofCallDriver(int DeviceObject , int Irp ) 
1262{ //int __VERIFIER_nondet_int() ;
1263  int returnVal2 ;
1264  int compRetStatus1 ;
1265  int lcontext ;
1266  unsigned long __cil_tmp7 ;
1267
1268  {
1269#line 985
1270  if (compRegistered) {
1271    {
1272#line 987
1273    compRetStatus1 = FloppyPnpComplete(DeviceObject, Irp, lcontext);
1274    }
1275    {
1276#line 989
1277    __cil_tmp7 = (unsigned long )compRetStatus1;
1278#line 989
1279    if (__cil_tmp7 == -1073741802) {
1280      {
1281#line 991
1282      stubMoreProcessingRequired();
1283      }
1284    }
1285    }
1286  }
1287#line 999
1288  int tmp_ndt_10;
1289  tmp_ndt_10 = __VERIFIER_nondet_int();
1290  if (tmp_ndt_10 == 0) {
1291    goto switch_8_0;
1292  } else {
1293#line 1002
1294    int tmp_ndt_11;
1295    tmp_ndt_11 = __VERIFIER_nondet_int();
1296    if (tmp_ndt_11 == 1) {
1297      goto switch_8_1;
1298    } else {
1299      goto switch_8_default;
1300#line 1007
1301      if (0) {
1302        switch_8_0: 
1303#line 1009
1304        returnVal2 = 0;
1305        goto switch_8_break;
1306        switch_8_1: 
1307#line 1012
1308        returnVal2 = -1073741823;
1309        goto switch_8_break;
1310        switch_8_default: 
1311#line 1015
1312        returnVal2 = 259;
1313        goto switch_8_break;
1314      } else {
1315        switch_8_break: ;
1316      }
1317    }
1318  }
1319#line 1023
1320  if (s == NP) {
1321#line 1024
1322    s = IPC;
1323#line 1025
1324    lowerDriverReturn = returnVal2;
1325  } else {
1326#line 1027
1327    if (s == MPR1) {
1328#line 1028
1329      if (returnVal2 == 259) {
1330#line 1029
1331        s = MPR3;
1332#line 1030
1333        lowerDriverReturn = returnVal2;
1334      } else {
1335#line 1032
1336        s = NP;
1337#line 1033
1338        lowerDriverReturn = returnVal2;
1339      }
1340    } else {
1341#line 1036
1342      if (s == SKIP1) {
1343#line 1037
1344        s = SKIP2;
1345#line 1038
1346        lowerDriverReturn = returnVal2;
1347      } else {
1348        {
1349#line 1041
1350        errorFn();
1351        }
1352      }
1353    }
1354  }
1355#line 1046
1356  return (returnVal2);
1357}
1358}
1359#line 1049 "floppy_simpl4.cil.c"
1360void IofCompleteRequest(int Irp , int PriorityBoost ) 
1361{ 
1362
1363  {
1364#line 1053
1365  if (s == NP) {
1366#line 1054
1367    s = DC;
1368  } else {
1369    {
1370#line 1057
1371    errorFn();
1372    }
1373  }
1374#line 1060
1375  return;
1376}
1377}
1378#line 1063 "floppy_simpl4.cil.c"
1379int KeSetEvent(int Event , int Increment , int Wait ) 
1380{ int l ;
1381
1382  {
1383#line 1067
1384  setEventCalled = 1;
1385#line 1068
1386  return (l);
1387}
1388}
1389#line 1071 "floppy_simpl4.cil.c"
1390int KeWaitForSingleObject(int Object , int WaitReason , int WaitMode , int Alertable ,
1391                          int Timeout ) 
1392{ //int __VERIFIER_nondet_int() ;
1393
1394  {
1395#line 1076
1396  if (s == MPR3) {
1397#line 1077
1398    if (setEventCalled == 1) {
1399#line 1078
1400      s = NP;
1401#line 1079
1402      setEventCalled = 0;
1403    } else {
1404      goto _L;
1405    }
1406  } else {
1407    _L: 
1408#line 1085
1409    if (customIrp == 1) {
1410#line 1086
1411      s = NP;
1412#line 1087
1413      customIrp = 0;
1414    } else {
1415#line 1089
1416      if (s == MPR3) {
1417        {
1418#line 1091
1419        errorFn();
1420        }
1421      }
1422    }
1423  }
1424#line 1098
1425  int tmp_ndt_12;
1426  tmp_ndt_12 = __VERIFIER_nondet_int();
1427  if (tmp_ndt_12 == 0) {
1428    goto switch_9_0;
1429  } else {
1430    goto switch_9_default;
1431#line 1103
1432    if (0) {
1433      switch_9_0: 
1434#line 1105
1435      return (0);
1436      switch_9_default: ;
1437#line 1107
1438      return (-1073741823);
1439    } else {
1440
1441    }
1442  }
1443}
1444}
1445#line 1115 "floppy_simpl4.cil.c"
1446int ObReferenceObjectByHandle(int Handle , int DesiredAccess , int ObjectType , int AccessMode ,
1447                              int Object , int HandleInformation ) 
1448{// int __VERIFIER_nondet_int() ;
1449
1450  {
1451#line 1120
1452  int tmp_ndt_13;
1453  tmp_ndt_13 = __VERIFIER_nondet_int();
1454  if (tmp_ndt_13 == 0) {
1455    goto switch_10_0;
1456  } else {
1457    goto switch_10_default;
1458#line 1125
1459    if (0) {
1460      switch_10_0: 
1461#line 1127
1462      return (0);
1463      switch_10_default: ;
1464#line 1129
1465      return (-1073741823);
1466    } else {
1467
1468    }
1469  }
1470}
1471}
1472#line 1137 "floppy_simpl4.cil.c"
1473int PsCreateSystemThread(int ThreadHandle , int DesiredAccess , int ObjectAttributes ,
1474                         int ProcessHandle , int ClientId , int StartRoutine , int StartContext ) 
1475{ //int __VERIFIER_nondet_int() ;
1476
1477  {
1478#line 1142
1479  int tmp_ndt_14;
1480  tmp_ndt_14 = __VERIFIER_nondet_int();
1481  if (tmp_ndt_14 == 0) {
1482    goto switch_11_0;
1483  } else {
1484    goto switch_11_default;
1485#line 1147
1486    if (0) {
1487      switch_11_0: 
1488#line 1149
1489      return (0);
1490      switch_11_default: ;
1491#line 1151
1492      return (-1073741823);
1493    } else {
1494
1495    }
1496  }
1497}
1498}
1499#line 1159 "floppy_simpl4.cil.c"
1500int ZwClose(int Handle ) 
1501{ //int __VERIFIER_nondet_int() ;
1502
1503  {
1504#line 1163
1505  int tmp_ndt_15;
1506  tmp_ndt_15 = __VERIFIER_nondet_int();
1507  if (tmp_ndt_15 == 0) {
1508    goto switch_12_0;
1509  } else {
1510    goto switch_12_default;
1511#line 1168
1512    if (0) {
1513      switch_12_0: 
1514#line 1170
1515      return (0);
1516      switch_12_default: ;
1517#line 1172
1518      return (-1073741823);
1519    } else {
1520
1521    }
1522  }
1523}
1524}
1525#line 1180 "floppy_simpl4.cil.c"
1526int FloppyCreateClose(int DeviceObject , int Irp ) 
1527{ int Irp__IoStatus__Status ;
1528  int Irp__IoStatus__Information ;
1529
1530  {
1531  {
1532#line 1186
1533  myStatus = 0;
1534#line 1187
1535  Irp__IoStatus__Status = 0;
1536#line 1188
1537  Irp__IoStatus__Information = 1;
1538#line 1189
1539  IofCompleteRequest(Irp, 0);
1540  }
1541#line 1191
1542  return (0);
1543}
1544}
1545#line 1194
1546int FloppyQueueRequest(int DisketteExtension , int Irp ) ;
1547#line 1195 "floppy_simpl4.cil.c"
1548int FloppyDeviceControl(int DeviceObject , int Irp ) 
1549{ int disketteExtension__HoldNewRequests ;
1550  int disketteExtension__IsRemoved ;
1551  int Irp__IoStatus__Information ;
1552  int disketteExtension__IsStarted ;
1553  int Irp__CurrentLocation ;
1554  int Irp__Tail__Overlay__CurrentStackLocation ;
1555  int disketteExtension__TargetObject ;
1556  int irpSp__Parameters__DeviceIoControl__OutputBufferLength ;
1557  int sizeof__MOUNTDEV_NAME ;
1558  int Irp__AssociatedIrp__SystemBuffer ;
1559  int mountName__NameLength ;
1560  int disketteExtension__DeviceName__Length ;
1561  int sizeof__USHORT ;
1562  int disketteExtension__InterfaceString__Buffer ;
1563  int uniqueId__UniqueIdLength ;
1564  int disketteExtension__InterfaceString__Length ;
1565  int sizeof__MOUNTDEV_UNIQUE_ID ;
1566  int irpSp__Parameters__DeviceIoControl__InputBufferLength ;
1567  int sizeof__FORMAT_PARAMETERS ;
1568  int irpSp__Parameters__DeviceIoControl__IoControlCode___1 ;
1569  int sizeof__FORMAT_EX_PARAMETERS ;
1570  int formatExParameters__FormatGapLength ;
1571  int formatExParameters__SectorsPerTrack ;
1572  int sizeof__DISK_GEOMETRY ;
1573  int Irp__IoStatus__Status___0 ;
1574  int disketteExtension ;
1575  int ntStatus ;
1576  int outputBufferLength ;
1577  int lowestDriveMediaType ;
1578  int highestDriveMediaType ;
1579  int formatExParametersSize ;
1580  int formatExParameters ;
1581  int tmp ;
1582  int mountName ;
1583  int uniqueId ;
1584  int tmp___0 ;
1585  int __cil_tmp39 ;
1586  int __cil_tmp40 ;
1587  int __cil_tmp41 ;
1588  int __cil_tmp42 ;
1589  int __cil_tmp43 ;
1590  int __cil_tmp44 ;
1591  int __cil_tmp45 ;
1592  int __cil_tmp46 ;
1593  int __cil_tmp47 ;
1594  int __cil_tmp48 ;
1595  int __cil_tmp49 ;
1596  int __cil_tmp50 ;
1597  int __cil_tmp51 ;
1598  int __cil_tmp52 ;
1599  int __cil_tmp53 ;
1600  int __cil_tmp54 ;
1601  int __cil_tmp55 ;
1602  int __cil_tmp56 ;
1603  int __cil_tmp57 ;
1604  int __cil_tmp58 ;
1605  int __cil_tmp59 ;
1606  int __cil_tmp60 ;
1607  int __cil_tmp61 ;
1608  int __cil_tmp62 ;
1609  int __cil_tmp63 ;
1610  int __cil_tmp64 ;
1611  int __cil_tmp65 ;
1612  int __cil_tmp66 ;
1613  int __cil_tmp67 ;
1614  int __cil_tmp68 ;
1615  int __cil_tmp69 ;
1616  int __cil_tmp70 ;
1617  int __cil_tmp71 ;
1618  int __cil_tmp72 ;
1619  int __cil_tmp73 ;
1620  int __cil_tmp74 ;
1621  int __cil_tmp75 ;
1622  int __cil_tmp76 ;
1623  int __cil_tmp77 ;
1624  int __cil_tmp78 ;
1625  int __cil_tmp79 ;
1626  int __cil_tmp80 ;
1627  int __cil_tmp81 ;
1628  int __cil_tmp82 ;
1629  int __cil_tmp83 ;
1630  int __cil_tmp84 ;
1631  int __cil_tmp85 ;
1632  int __cil_tmp86 ;
1633  int __cil_tmp87 ;
1634  int __cil_tmp88 ;
1635  int __cil_tmp89 ;
1636  int __cil_tmp90 ;
1637  long __cil_tmp91 ;
1638
1639  {
1640#line 1234
1641  if (disketteExtension__HoldNewRequests) {
1642    {
1643#line 1235
1644    //__cil_tmp39 = 3 << 14;
1645#line 1235
1646    //__cil_tmp40 = 50 << 16;
1647#line 1235
1648    //__cil_tmp41 = __cil_tmp40 | __cil_tmp39;
1649#line 1235
1650    if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 != __cil_tmp41) {
1651      {
1652#line 1237
1653      ntStatus = FloppyQueueRequest(disketteExtension, Irp);
1654      }
1655#line 1239
1656      return (ntStatus);
1657    }
1658    }
1659  }
1660#line 1246
1661  if (disketteExtension__IsRemoved) {
1662    {
1663#line 1248
1664    Irp__IoStatus__Information = 0;
1665#line 1249
1666    Irp__IoStatus__Status___0 = -1073741738;
1667#line 1250
1668    myStatus = -1073741738;
1669#line 1251
1670    IofCompleteRequest(Irp, 0);
1671    }
1672#line 1253
1673    return (-1073741738);
1674  }
1675#line 1257
1676  if (! disketteExtension__IsStarted) {
1677#line 1258
1678    if (s == NP) {
1679#line 1259
1680      s = SKIP1;
1681    } else {
1682      {
1683#line 1262
1684      errorFn();
1685      }
1686    }
1687    {
1688#line 1266
1689    Irp__CurrentLocation ++;
1690#line 1267
1691    Irp__Tail__Overlay__CurrentStackLocation ++;
1692#line 1268
1693    tmp = IofCallDriver(disketteExtension__TargetObject, Irp);
1694    }
1695#line 1270
1696    return (tmp);
1697  }
1698  {
1699#line 1274
1700  //__cil_tmp42 = 2 << 2;
1701#line 1274
1702  //__cil_tmp43 = 77 << 16;
1703#line 1274
1704  //__cil_tmp44 = __cil_tmp43 | __cil_tmp42;
1705#line 1274
1706  if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp44) {
1707    goto switch_13_exp_0;
1708  } else {
1709    {
1710#line 1277
1711    //__cil_tmp45 = 77 << 16;
1712#line 1277
1713    if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp45) {
1714      goto switch_13_exp_1;
1715    } else {
1716      {
1717#line 1280
1718      //__cil_tmp46 = 6 << 2;
1719#line 1280
1720      //__cil_tmp47 = 3 << 14;
1721#line 1280
1722      //__cil_tmp48 = 7 << 16;
1723#line 1280
1724      //__cil_tmp49 = __cil_tmp48 | __cil_tmp47;
1725#line 1280
1726      //__cil_tmp50 = __cil_tmp49 | __cil_tmp46;
1727#line 1280
1728      if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp50) {
1729        goto switch_13_exp_2;
1730      } else {
1731        {
1732#line 1283
1733       // __cil_tmp51 = 11 << 2;
1734#line 1283
1735        //__cil_tmp52 = 3 << 14;
1736#line 1283
1737        //__cil_tmp53 = 7 << 16;
1738#line 1283
1739       // __cil_tmp54 = __cil_tmp53 | __cil_tmp52;
1740#line 1283
1741        //__cil_tmp55 = __cil_tmp54 | __cil_tmp51;
1742#line 1283
1743        if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp55) {
1744          goto switch_13_exp_3;
1745        } else {
1746          {
1747#line 1286
1748         // __cil_tmp56 = 512 << 2;
1749#line 1286
1750         // __cil_tmp57 = 1 << 14;
1751#line 1286
1752         // __cil_tmp58 = 7 << 16;
1753#line 1286
1754          //__cil_tmp59 = __cil_tmp58 | __cil_tmp57;
1755#line 1286
1756         // __cil_tmp60 = __cil_tmp59 | __cil_tmp56;
1757#line 1286
1758          if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp60) {
1759            goto switch_13_exp_4;
1760          } else {
1761            {
1762#line 1289
1763            //__cil_tmp61 = 512 << 2;
1764#line 1289
1765            //__cil_tmp62 = 1 << 14;
1766#line 1289
1767           // __cil_tmp63 = 45 << 16;
1768#line 1289
1769            //__cil_tmp64 = __cil_tmp63 | __cil_tmp62;
1770#line 1289
1771            //__cil_tmp65 = __cil_tmp64 | __cil_tmp61;
1772#line 1289
1773            if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp65) {
1774              goto switch_13_exp_5;
1775            } else {
1776              {
1777#line 1292
1778              //__cil_tmp66 = 7 << 16;
1779#line 1292
1780              if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp66) {
1781                goto switch_13_exp_6;
1782              } else {
1783                {
1784#line 1295
1785                //__cil_tmp67 = 9 << 2;
1786#line 1295
1787                //__cil_tmp68 = 7 << 16;
1788#line 1295
1789                //__cil_tmp69 = __cil_tmp68 | __cil_tmp67;
1790#line 1295
1791                if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp69) {
1792                  goto switch_13_exp_7;
1793                } else {
1794                  {
1795#line 1298
1796                  //__cil_tmp70 = 768 << 2;
1797#line 1298
1798                  //__cil_tmp71 = 7 << 16;
1799#line 1298
1800                  //__cil_tmp72 = __cil_tmp71 | __cil_tmp70;
1801#line 1298
1802                  if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp72) {
1803                    goto switch_13_exp_8;
1804                  } else {
1805                    {
1806#line 1301
1807                    //__cil_tmp73 = 768 << 2;
1808#line 1301
1809                   // __cil_tmp74 = 45 << 16;
1810#line 1301
1811                    //__cil_tmp75 = __cil_tmp74 | __cil_tmp73;
1812#line 1301
1813                    if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp75) {
1814                      goto switch_13_exp_9;
1815                    } else {
1816                      {
1817#line 1304
1818                      //__cil_tmp76 = 3 << 2;
1819#line 1304
1820                      //__cil_tmp77 = 77 << 16;
1821#line 1304
1822                      //__cil_tmp78 = __cil_tmp77 | __cil_tmp76;
1823#line 1304
1824                      if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp78) {
1825                        goto switch_13_exp_10;
1826                      } else {
1827                        {
1828#line 1307
1829                        //__cil_tmp79 = 248 << 2;
1830#line 1307
1831                        //__cil_tmp80 = 7 << 16;
1832#line 1307
1833                        //__cil_tmp81 = __cil_tmp80 | __cil_tmp79;
1834#line 1307
1835                        if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp81) {
1836                          goto switch_13_exp_11;
1837                        } else {
1838                          goto switch_13_default;
1839#line 1312
1840                          if (0) {
1841                            switch_13_exp_0: ;
1842#line 1314
1843                            if (irpSp__Parameters__DeviceIoControl__OutputBufferLength < sizeof__MOUNTDEV_NAME) {
1844#line 1315
1845                              ntStatus = -1073741811;
1846                              goto switch_13_break;
1847                            }
1848#line 1320
1849                            mountName = Irp__AssociatedIrp__SystemBuffer;
1850#line 1321
1851                            mountName__NameLength = disketteExtension__DeviceName__Length;
1852                            {
1853#line 1322
1854                            __cil_tmp82 = sizeof__USHORT + mountName__NameLength;
1855#line 1322
1856                            if (irpSp__Parameters__DeviceIoControl__OutputBufferLength < __cil_tmp82) {
1857#line 1323
1858                              ntStatus = -2147483643;
1859#line 1324
1860                              Irp__IoStatus__Information = sizeof__MOUNTDEV_NAME;
1861                              goto switch_13_break;
1862                            }
1863                            }
1864#line 1329
1865                            ntStatus = 0;
1866#line 1330
1867                            Irp__IoStatus__Information = sizeof__USHORT + mountName__NameLength;
1868                            goto switch_13_break;
1869                            switch_13_exp_1: ;
1870#line 1333
1871                            if (! disketteExtension__InterfaceString__Buffer) {
1872#line 1334
1873                              ntStatus = -1073741811;
1874                              goto switch_13_break;
1875                            } else {
1876#line 1337
1877                              if (irpSp__Parameters__DeviceIoControl__OutputBufferLength < sizeof__MOUNTDEV_UNIQUE_ID) {
1878#line 1338
1879                                ntStatus = -1073741811;
1880                                goto switch_13_break;
1881                              }
1882                            }
1883#line 1344
1884                            uniqueId = Irp__AssociatedIrp__SystemBuffer;
1885#line 1345
1886                            uniqueId__UniqueIdLength = disketteExtension__InterfaceString__Length;
1887                            {
1888#line 1346
1889                            __cil_tmp83 = sizeof__USHORT + uniqueId__UniqueIdLength;
1890#line 1346
1891                            if (irpSp__Parameters__DeviceIoControl__OutputBufferLength < __cil_tmp83) {
1892#line 1347
1893                              ntStatus = -2147483643;
1894#line 1348
1895                              Irp__IoStatus__Information = sizeof__MOUNTDEV_UNIQUE_ID;
1896                              goto switch_13_break;
1897                            }
1898                            }
1899#line 1353
1900                            ntStatus = 0;
1901#line 1354
1902                            Irp__IoStatus__Information = sizeof__USHORT + uniqueId__UniqueIdLength;
1903                            goto switch_13_break;
1904                            switch_13_exp_2: ;
1905                            switch_13_exp_3: ;
1906#line 1358
1907                            if (irpSp__Parameters__DeviceIoControl__InputBufferLength < sizeof__FORMAT_PARAMETERS) {
1908#line 1359
1909                              ntStatus = -1073741811;
1910                              goto switch_13_break;
1911                            }
1912                            {
1913#line 1365
1914                            tmp___0 = FlCheckFormatParameters(disketteExtension, Irp__AssociatedIrp__SystemBuffer);
1915                            }
1916#line 1367
1917                            if (! tmp___0) {
1918#line 1370
1919                              ntStatus = -1073741811;
1920                              goto switch_13_break;
1921                            }
1922                            {
1923#line 1373
1924                            //__cil_tmp84 = 11 << 2;
1925#line 1373
1926                            //__cil_tmp85 = 3 << 14;
1927#line 1373
1928                            //__cil_tmp86 = 7 << 16;
1929#line 1373
1930                            //__cil_tmp87 = __cil_tmp86 | __cil_tmp85;
1931#line 1373
1932                            //__cil_tmp88 = __cil_tmp87 | __cil_tmp84;
1933#line 1373
1934                            if (irpSp__Parameters__DeviceIoControl__IoControlCode___1 == __cil_tmp88) {
1935#line 1374
1936                              if (irpSp__Parameters__DeviceIoControl__InputBufferLength < sizeof__FORMAT_EX_PARAMETERS) {
1937#line 1375
1938                                ntStatus = -1073741811;
1939                                goto switch_13_break;
1940                              }
1941#line 1380
1942                              formatExParameters = Irp__AssociatedIrp__SystemBuffer;
1943#line 1381
1944                              if (irpSp__Parameters__DeviceIoControl__InputBufferLength < formatExParametersSize) {
1945#line 1382
1946                                ntStatus = -1073741811;
1947                                goto switch_13_break;
1948                              } else {
1949#line 1385
1950                                if (formatExParameters__FormatGapLength >= 256) {
1951#line 1386
1952                                  ntStatus = -1073741811;
1953                                  goto switch_13_break;
1954                                } else {
1955#line 1389
1956                                  if (formatExParameters__SectorsPerTrack >= 256) {
1957#line 1390
1958                                    ntStatus = -1073741811;
1959                                    goto switch_13_break;
1960                                  }
1961                                }
1962                              }
1963                            }
1964                            }
1965                            switch_13_exp_4: ;
1966                            switch_13_exp_5: ;
1967                            switch_13_exp_6: ;
1968                            switch_13_exp_7: 
1969                            {
1970#line 1405
1971                            ntStatus = FlQueueIrpToThread(Irp, disketteExtension);
1972                            }
1973                            goto switch_13_break;
1974                            switch_13_exp_8: ;
1975                            switch_13_exp_9: 
1976#line 1410
1977                            outputBufferLength = irpSp__Parameters__DeviceIoControl__OutputBufferLength;
1978#line 1411
1979                            if (outputBufferLength < sizeof__DISK_GEOMETRY) {
1980#line 1412
1981                              ntStatus = -1073741789;
1982                              goto switch_13_break;
1983                            }
1984#line 1417
1985                            ntStatus = 0;
1986                            {
1987#line 1418
1988                            __cil_tmp89 = highestDriveMediaType - lowestDriveMediaType;
1989#line 1418
1990                            __cil_tmp90 = __cil_tmp89 + 1;
1991#line 1418
1992                            if (outputBufferLength < __cil_tmp90) {
1993#line 1419
1994                              ntStatus = -2147483643;
1995                            }
1996                            }
1997                            goto switch_13_break;
1998                            switch_13_exp_10: ;
1999                            switch_13_exp_11: ;
2000                            switch_13_default: ;
2001#line 1427
2002                            if (s == NP) {
2003#line 1428
2004                              s = SKIP1;
2005                            } else {
2006                              {
2007#line 1431
2008                              errorFn();
2009                              }
2010                            }
2011                            {
2012#line 1435
2013                            Irp__CurrentLocation ++;
2014#line 1436
2015                            Irp__Tail__Overlay__CurrentStackLocation ++;
2016#line 1437
2017                            ntStatus = IofCallDriver(disketteExtension__TargetObject,
2018                                                     Irp);
2019                            }
2020#line 1440
2021                            return (ntStatus);
2022                          } else {
2023                            switch_13_break: ;
2024                          }
2025                        }
2026                        }
2027                      }
2028                      }
2029                    }
2030                    }
2031                  }
2032                  }
2033                }
2034                }
2035              }
2036              }
2037            }
2038            }
2039          }
2040          }
2041        }
2042        }
2043      }
2044      }
2045    }
2046    }
2047  }
2048  }
2049  {
2050#line 1457
2051  __cil_tmp91 = (long )ntStatus;
2052#line 1457
2053  if (__cil_tmp91 != 259L) {
2054    {
2055#line 1459
2056    Irp__IoStatus__Status___0 = ntStatus;
2057#line 1460
2058    myStatus = ntStatus;
2059#line 1461
2060    IofCompleteRequest(Irp, 0);
2061    }
2062  }
2063  }
2064#line 1466
2065  return (ntStatus);
2066}
2067}
2068#line 1469 "floppy_simpl4.cil.c"
2069int FlCheckFormatParameters(int DisketteExtension , int FormatParameters ) 
2070{ int DriveMediaConstants__driveMediaType__MediaType ;
2071  int FormatParameters__MediaType ;
2072  int FAKE_CONDITION ;
2073
2074  {
2075#line 1475
2076  if (DriveMediaConstants__driveMediaType__MediaType != FormatParameters__MediaType) {
2077#line 1476
2078    return (0);
2079  } else {
2080#line 1478
2081    if (FAKE_CONDITION) {
2082#line 1479
2083      return (0);
2084    } else {
2085#line 1481
2086      return (1);
2087    }
2088  }
2089}
2090}
2091#line 1486 "floppy_simpl4.cil.c"
2092int FloppyQueueRequest(int DisketteExtension , int Irp ) 
2093{ int Irp__IoStatus__Status ;
2094  int Irp__IoStatus__Information ;
2095  int Irp__Tail__Overlay__CurrentStackLocation__Control ;
2096  int ntStatus ;
2097  int FAKE_CONDITION ;
2098
2099  {
2100#line 1494
2101  PagingReferenceCount ++;
2102#line 1495
2103  if (PagingReferenceCount == 1) {
2104
2105  }
2106#line 1500
2107  if (FAKE_CONDITION) {
2108    {
2109#line 1502
2110    Irp__IoStatus__Status = -1073741536;
2111#line 1503
2112    myStatus = -1073741536;
2113#line 1504
2114    Irp__IoStatus__Information = 0;
2115#line 1505
2116    IofCompleteRequest(Irp, 0);
2117#line 1506
2118    PagingReferenceCount --;
2119    }
2120#line 1508
2121    if (PagingReferenceCount == 0) {
2122
2123    }
2124#line 1513
2125    ntStatus = -1073741536;
2126  } else {
2127#line 1515
2128    Irp__IoStatus__Status = 259;
2129#line 1516
2130    myStatus = 259;
2131#line 1517
2132    //Irp__Tail__Overlay__CurrentStackLocation__Control |= 1;
2133#line 1518
2134    if (pended == 0) {
2135#line 1519
2136      pended = 1;
2137    } else {
2138      {
2139#line 1522
2140      errorFn();
2141      }
2142    }
2143#line 1525
2144    ntStatus = 259;
2145  }
2146#line 1527
2147  return (ntStatus);
2148}
2149}
2150
2151void errorFn(void) 
2152{ 
2153
2154  {
2155  goto ERROR;
2156  ERROR: 
2157#line 53
2158  return;
2159}
2160}