#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 */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBDevEndpointStall(uint32_t ui32Base, uint32_t ui32Endpoint,
                         uint32_t ui32Flags) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT((ui32Flags & ~(0x00002000 | 0x00000000)) == 0);
  ASSERT((ui32Endpoint == 0x00000000) || (ui32Endpoint == 0x00000010) ||
         (ui32Endpoint == 0x00000020) || (ui32Endpoint == 0x00000030) ||
         (ui32Endpoint == 0x00000040) || (ui32Endpoint == 0x00000050) ||
         (ui32Endpoint == 0x00000060) || (ui32Endpoint == 0x00000070));
  if (ui32Endpoint == 0x00000000) {
    (*((volatile uint8_t *)(ui32Base + 0x00000102))) |= 0x00000020 | 0x00000040;
  } else if (ui32Flags == 0x00002000) {
    (*((volatile uint8_t *)(ui32Base + 0x00000112 + (ui32Endpoint - 0x10)))) |=
        0x00000010;
  } else {
    (*((volatile uint8_t *)(ui32Base + 0x00000116 + (ui32Endpoint - 0x10)))) |=
        0x00000020;
  }
}


x86 assembly (clang, -O0):
<USBDevEndpointStall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0xc(%rbp),%eax
and    $0xffffdfff,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11c0 <USBDevEndpointStall+0xb0>
mov    $0x1,%al
cmpl   $0x10,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11c0 <USBDevEndpointStall+0xb0>
mov    $0x1,%al
cmpl   $0x20,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11c0 <USBDevEndpointStall+0xb0>
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11c0 <USBDevEndpointStall+0xb0>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11c0 <USBDevEndpointStall+0xb0>
mov    $0x1,%al
cmpl   $0x50,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11c0 <USBDevEndpointStall+0xb0>
mov    $0x1,%al
cmpl   $0x60,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     11c0 <USBDevEndpointStall+0xb0>
cmpl   $0x70,-0x8(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11ed <USBDevEndpointStall+0xdd>
mov    -0x4(%rbp),%eax
add    $0x102,%eax
cltq
mov    (%rax),%ecx
or     $0x60,%ecx
mov    %ecx,(%rax)
jmp    1236 <USBDevEndpointStall+0x126>
cmpl   $0x2000,-0xc(%rbp)
jne    1218 <USBDevEndpointStall+0x108>
mov    -0x4(%rbp),%eax
add    $0x112,%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
jmp    1231 <USBDevEndpointStall+0x121>
mov    -0x4(%rbp),%eax
add    $0x116,%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%ecx
or     $0x20,%ecx
mov    %ecx,(%rax)
jmp    1236 <USBDevEndpointStall+0x126>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDevEndpointStall>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%r14d
xor    %edi,%edi
cmp    $0x40050000,%r14d
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0xffffdfff,%ebp
sete   %dil
call   1030 <ASSERT@plt>
mov    %ebx,%eax
rol    $0x1c,%eax
cmp    $0x7,%eax
setb   %al
cmp    $0x70,%ebx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <ASSERT@plt>
test   %ebx,%ebx
je     1176 <USBDevEndpointStall+0x66>
cmp    $0x2000,%ebp
jne    1184 <USBDevEndpointStall+0x74>
add    %ebx,%r14d
add    $0x102,%r14d
mov    $0x10,%eax
jmp    1193 <USBDevEndpointStall+0x83>
add    $0x102,%r14d
mov    $0x60,%eax
jmp    1193 <USBDevEndpointStall+0x83>
add    %ebx,%r14d
add    $0x106,%r14d
mov    $0x20,%eax
movslq %r14d,%rcx
or     %eax,(%rcx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBDevEndpointStall(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1074069504
%9 = zext i1 %8 to i32
%10 = call i32 @ASSERT(i32 %9)
%11 = load i32, i32* %6
%12 = and i32 %11, -8193
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @ASSERT(i32 %14)
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 0
br i1 %17, label %39, label %18
18: ; preds = %3
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 16
br i1 %20, label %39, label %21
21: ; preds = %18
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 32
br i1 %23, label %39, label %24
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 48
br i1 %26, label %39, label %27
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 64
br i1 %29, label %39, label %30
30: ; preds = %27
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, 80
br i1 %32, label %39, label %33
33: ; preds = %30
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 96
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 112
br label %39
39: ; preds = %36, %33, %30, %27, %24, %21, %18, %3
%40 = phi i1 [ true, %33 ], [ true, %30 ], [ true, %27 ], [ true, %24 ], [ true, %21 ], [ true, %18 ], [ true, %3 ], [ %38, %36 ]
%41 = zext i1 %40 to i32
%42 = call i32 @ASSERT(i32 %41)
%43 = load i32, i32* %5
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %52
45: ; preds = %39
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 258
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
%50 = load volatile i32, i32* %49
%51 = or i32 %50, 96
store volatile i32 %51, i32* %49
br label %76
52: ; preds = %39
%53 = load i32, i32* %6
%54 = icmp eq i32 %53, 8192
br i1 %54, label %55, label %65
55: ; preds = %52
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 274
%58 = load i32, i32* %5
%59 = sub nsw i32 %58, 16
%60 = add nsw i32 %57, %59
%61 = sext i32 %60 to i64
%62 = inttoptr i64 %61 to i32*
%63 = load volatile i32, i32* %62
%64 = or i32 %63, 16
store volatile i32 %64, i32* %62
br label %75
65: ; preds = %52
%66 = load i32, i32* %4
%67 = add nsw i32 %66, 278
%68 = load i32, i32* %5
%69 = sub nsw i32 %68, 16
%70 = add nsw i32 %67, %69
%71 = sext i32 %70 to i64
%72 = inttoptr i64 %71 to i32*
%73 = load volatile i32, i32* %72
%74 = or i32 %73, 32
store volatile i32 %74, i32* %72
br label %75
75: ; preds = %65, %55
br label %76
76: ; preds = %75, %45
ret void
}

LLVM IR (-O2):
define void @USBDevEndpointStall(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1074069504
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = and i32 %2, -8193
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @ASSERT(i32 %9)
%11 = icmp eq i32 %1, 0
%12 = tail call i32 @llvm.fshl.i32(i32 %1, i32 %1, i32 28)
%13 = icmp ult i32 %12, 7
%14 = icmp eq i32 %1, 112
%15 = or i1 %14, %13
%16 = zext i1 %15 to i32
%17 = tail call i32 @ASSERT(i32 %16)
br i1 %11, label %18, label %20
18: ; preds = %3
%19 = add nsw i32 %0, 258
br label %28
20: ; preds = %3
%21 = icmp eq i32 %2, 8192
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = add i32 %0, 258
%24 = add i32 %23, %1
br label %28
25: ; preds = %20
%26 = add i32 %1, %0
%27 = add i32 %26, 262
br label %28
28: ; preds = %22, %25, %18
%29 = phi i32 [ %24, %22 ], [ %27, %25 ], [ %19, %18 ]
%30 = phi i32 [ 16, %22 ], [ 32, %25 ], [ 96, %18 ]
%31 = sext i32 %29 to i64
%32 = inttoptr i64 %31 to i32*
%33 = load volatile i32, i32* %32
%34 = or i32 %33, %30
store volatile i32 %34, i32* %32
ret void
}