#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int DiskPerfRemoveDevice(int, int);
int DiskPerfSendToNextDriver(int, int);
int DiskPerfStartDevice(int, int);
int __VERIFIER_nondet_int();
int DiskPerfDispatchPnp(int DeviceObject, int Irp) {
  int Irp__Tail__Overlay__CurrentStackLocation = __VERIFIER_nondet_int();
  int irpSp__MinorFunction = __VERIFIER_nondet_int();
  int irpSp;
  int status;
  int tmp;
  {
    irpSp = Irp__Tail__Overlay__CurrentStackLocation;
    if (irpSp__MinorFunction == 0) {
      goto switch_0_0;
    } else {
      if (irpSp__MinorFunction == 2) {
        goto switch_0_2;
      } else {
        goto switch_0_default;
        if (0) {
        switch_0_0 : { status = DiskPerfStartDevice(DeviceObject, Irp); }
          goto switch_0_break;
        switch_0_2 : { status = DiskPerfRemoveDevice(DeviceObject, Irp); }
          goto switch_0_break;
        switch_0_default : {
          tmp = DiskPerfSendToNextDriver(DeviceObject, Irp);
        }
          return (tmp);
        } else {
        switch_0_break:;
        }
      }
    }
    return (status);
  }
}


x86 assembly (clang, -O0):
<DiskPerfDispatchPnp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1050 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1177 <DiskPerfDispatchPnp+0x37>
jmp    118b <DiskPerfDispatchPnp+0x4b>
cmpl   $0x2,-0x14(%rbp)
jne    1186 <DiskPerfDispatchPnp+0x46>
jmp    119e <DiskPerfDispatchPnp+0x5e>
jmp    11b1 <DiskPerfDispatchPnp+0x71>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <DiskPerfStartDevice@plt>
mov    %eax,-0x1c(%rbp)
jmp    11ca <DiskPerfDispatchPnp+0x8a>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <DiskPerfRemoveDevice@plt>
mov    %eax,-0x1c(%rbp)
jmp    11ca <DiskPerfDispatchPnp+0x8a>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <DiskPerfSendToNextDriver@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11df <DiskPerfDispatchPnp+0x9f>
jmp    11cf <DiskPerfDispatchPnp+0x8f>
jmp    11d4 <DiskPerfDispatchPnp+0x94>
jmp    11d9 <DiskPerfDispatchPnp+0x99>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DiskPerfDispatchPnp>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1050 <__VERIFIER_nondet_int@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
cmp    $0x2,%eax
je     116d <DiskPerfDispatchPnp+0x2d>
test   %eax,%eax
jne    1174 <DiskPerfDispatchPnp+0x34>
pop    %rbx
pop    %rbp
jmp    1060 <DiskPerfStartDevice@plt>
pop    %rbx
pop    %rbp
jmp    1040 <DiskPerfRemoveDevice@plt>
pop    %rbx
pop    %rbp
jmp    1030 <DiskPerfSendToNextDriver@plt>

LLVM IR (-O0):
define i32 @DiskPerfDispatchPnp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%11 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %11, i32* %6
%12 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %12, i32* %7
%13 = load i32, i32* %6
store i32 %13, i32* %8
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
br label %24
17: ; preds = %2
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %21
20: ; preds = %17
br label %28
21: ; preds = %17
br label %32
22: ; No predecessors!
br i1 false, label %23, label %37
23: ; preds = %22
br label %24
24: ; preds = %23, %16
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 @DiskPerfStartDevice(i32 %25, i32 %26)
store i32 %27, i32* %9
br label %38
28: ; preds = %20
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = call i32 @DiskPerfRemoveDevice(i32 %29, i32 %30)
store i32 %31, i32* %9
br label %38
32: ; preds = %21
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = call i32 @DiskPerfSendToNextDriver(i32 %33, i32 %34)
store i32 %35, i32* %10
%36 = load i32, i32* %10
store i32 %36, i32* %3
br label %43
37: ; preds = %22
br label %38
38: ; preds = %37, %28, %24
br label %39
39: ; preds = %38
br label %40
40: ; preds = %39
br label %41
41: ; preds = %40
%42 = load i32, i32* %9
store i32 %42, i32* %3
br label %43
43: ; preds = %41, %32
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
define i32 @DiskPerfDispatchPnp(i32 %0, i32 %1) {
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
%4 = tail call i32 (...) @__VERIFIER_nondet_int()
switch i32 %4, label %9 [
i32 0, label %5
i32 2, label %7
]
5: ; preds = %2
%6 = tail call i32 @DiskPerfStartDevice(i32 %0, i32 %1)
br label %11
7: ; preds = %2
%8 = tail call i32 @DiskPerfRemoveDevice(i32 %0, i32 %1)
br label %11
9: ; preds = %2
%10 = tail call i32 @DiskPerfSendToNextDriver(i32 %0, i32 %1)
br label %11
11: ; preds = %7, %5, %9
%12 = phi i32 [ %10, %9 ], [ %6, %5 ], [ %8, %7 ]
ret i32 %12
}