#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 */
struct vusb_connect_descriptors {
  int dummy;
};
struct usb_ctrlrequest {
  int bRequestType;
  int /*<<< orphan*/ bRequest;
};

/* Variables and functions */
#define USB_REQ_SET_CONFIGURATION 129
int USB_TYPE_MASK;
#define USB_TYPE_STANDARD 128
bool lookup_connect_response_out_generic(
    int fd, const struct vusb_connect_descriptors *descs,
    const struct usb_ctrlrequest *ctrl, bool *done) {
  switch (ctrl->bRequestType & USB_TYPE_MASK) {
  case USB_TYPE_STANDARD:
    switch (ctrl->bRequest) {
    case USB_REQ_SET_CONFIGURATION:
      *done = true;
      return true;
    default:
      break;
    }
    break;
  }
  return false;
}


x86 assembly (clang, -O0):
<lookup_connect_response_out_generic>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    0x2ec0(%rip),%rcx
mov    (%rcx),%ecx
and    %ecx,%eax
sub    $0x80,%eax
jne    116b <lookup_connect_response_out_generic+0x6b>
jmp    1134 <lookup_connect_response_out_generic+0x34>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
sub    $0x81,%eax
jne    1161 <lookup_connect_response_out_generic+0x61>
jmp    114b <lookup_connect_response_out_generic+0x4b>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1172 <lookup_connect_response_out_generic+0x72>
jmp    1166 <lookup_connect_response_out_generic+0x66>
jmp    116b <lookup_connect_response_out_generic+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup_connect_response_out_generic>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%esi
and    (%rdx),%esi
xor    %eax,%eax
cmp    $0x80,%esi
jne    1129 <lookup_connect_response_out_generic+0x29>
cmpl   $0x81,0x4(%rdx)
jne    1129 <lookup_connect_response_out_generic+0x29>
movl   $0x1,(%rcx)
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.vusb_connect_descriptors = type { i32 }
%struct.usb_ctrlrequest = type { i32, i32 }
@USB_TYPE_MASK = global i32 0
define i32 @lookup_connect_response_out_generic(i32 %0, %struct.vusb_connect_descriptors* %1, %struct.usb_ctrlrequest* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.vusb_connect_descriptors*
%8 = alloca %struct.usb_ctrlrequest*
%9 = alloca i32*
store i32 %0, i32* %6
store %struct.vusb_connect_descriptors* %1, %struct.vusb_connect_descriptors** %7
store %struct.usb_ctrlrequest* %2, %struct.usb_ctrlrequest** %8
store i32* %3, i32** %9
%10 = load %struct.usb_ctrlrequest*, %struct.usb_ctrlrequest** %8
%11 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = load i32, i32* @USB_TYPE_MASK
%14 = and i32 %12, %13
switch i32 %14, label %23 [
i32 128, label %15
]
15: ; preds = %4
%16 = load %struct.usb_ctrlrequest*, %struct.usb_ctrlrequest** %8
%17 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %16, i32 0, i32 1
%18 = load i32, i32* %17
switch i32 %18, label %21 [
i32 129, label %19
]
19: ; preds = %15
%20 = load i32*, i32** %9
store i32 1, i32* %20
store i32 1, i32* %5
br label %24
21: ; preds = %15
br label %22
22: ; preds = %21
br label %23
23: ; preds = %4, %22
store i32 0, i32* %5
br label %24
24: ; preds = %23, %19
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
%struct.vusb_connect_descriptors = type { i32 }
%struct.usb_ctrlrequest = type { i32, i32 }
@USB_TYPE_MASK = global i32 0
define i32 @lookup_connect_response_out_generic(i32 %0, %struct.vusb_connect_descriptors* nocapture readnone %1, %struct.usb_ctrlrequest* nocapture %2, i32* nocapture writeonly %3) {
%5 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %2, i64 0, i32 0
%6 = load i32, i32* %5
%7 = load i32, i32* @USB_TYPE_MASK
%8 = and i32 %7, %6
%9 = icmp eq i32 %8, 128
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %2, i64 0, i32 1
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 129
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %3
br label %15
15: ; preds = %4, %10, %14
%16 = phi i32 [ 1, %14 ], [ 0, %10 ], [ 0, %4 ]
ret i32 %16
}