#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void uDMAChannelAttributeEnable(uint32_t ui32ChannelNum, uint32_t ui32Attr) {
  ASSERT((ui32ChannelNum & 0xffff) < 32);
  ASSERT((ui32Attr & ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008)) ==
         0);
  ui32ChannelNum &= 0x1f;
  if (ui32Attr & 0x00000001) {
    (*((volatile uint32_t *)(0x400FF018))) = 1 << ui32ChannelNum;
  }
  if (ui32Attr & 0x00000002) {
    (*((volatile uint32_t *)(0x400FF030))) = 1 << ui32ChannelNum;
  }
  if (ui32Attr & 0x00000004) {
    (*((volatile uint32_t *)(0x400FF038))) = 1 << ui32ChannelNum;
  }
  if (ui32Attr & 0x00000008) {
    (*((volatile uint32_t *)(0x400FF020))) = 1 << ui32ChannelNum;
  }
}


x86 assembly (clang, -O0):
<uDMAChannelAttributeEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
cmp    $0x20,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
and    $0xfffffff0,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
and    $0x1f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1177 <uDMAChannelAttributeEnable+0x67>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x400ff018,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1199 <uDMAChannelAttributeEnable+0x89>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x400ff030,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11bb <uDMAChannelAttributeEnable+0xab>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x400ff038,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11dd <uDMAChannelAttributeEnable+0xcd>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x400ff020,%eax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAChannelAttributeEnable>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
test   $0xffe0,%ebx
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x10,%ebp
setb   %dil
call   1030 <ASSERT@plt>
and    $0x1f,%ebx
test   $0x1,%bpl
jne    1168 <uDMAChannelAttributeEnable+0x58>
test   $0x2,%bpl
jne    117e <uDMAChannelAttributeEnable+0x6e>
test   $0x4,%bpl
jne    1194 <uDMAChannelAttributeEnable+0x84>
test   $0x8,%bpl
je     1161 <uDMAChannelAttributeEnable+0x51>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0x400ff020
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0x400ff018
test   $0x2,%bpl
je     1145 <uDMAChannelAttributeEnable+0x35>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0x400ff030
test   $0x4,%bpl
je     114b <uDMAChannelAttributeEnable+0x3b>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0x400ff038
test   $0x8,%bpl
jne    1151 <uDMAChannelAttributeEnable+0x41>
jmp    1161 <uDMAChannelAttributeEnable+0x51>

LLVM IR (-O0):
define void @uDMAChannelAttributeEnable(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = and i32 %5, 65535
%7 = icmp slt i32 %6, 32
%8 = zext i1 %7 to i32
%9 = call i32 @ASSERT(i32 %8)
%10 = load i32, i32* %4
%11 = and i32 %10, -16
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @ASSERT(i32 %13)
%15 = load i32, i32* %3
%16 = and i32 %15, 31
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = and i32 %17, 1
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = load i32, i32* %3
%22 = shl i32 1, %21
store volatile i32 %22, i32* inttoptr (i64 1074786328 to i32*)
br label %23
23: ; preds = %20, %2
%24 = load i32, i32* %4
%25 = and i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %3
%29 = shl i32 1, %28
store volatile i32 %29, i32* inttoptr (i64 1074786352 to i32*)
br label %30
30: ; preds = %27, %23
%31 = load i32, i32* %4
%32 = and i32 %31, 4
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %3
%36 = shl i32 1, %35
store volatile i32 %36, i32* inttoptr (i64 1074786360 to i32*)
br label %37
37: ; preds = %34, %30
%38 = load i32, i32* %4
%39 = and i32 %38, 8
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load i32, i32* %3
%43 = shl i32 1, %42
store volatile i32 %43, i32* inttoptr (i64 1074786336 to i32*)
br label %44
44: ; preds = %41, %37
ret void
}

LLVM IR (-O2):
define void @uDMAChannelAttributeEnable(i32 %0, i32 %1) {
%3 = and i32 %0, 65504
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = icmp ult i32 %1, 16
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = and i32 %0, 31
%11 = and i32 %1, 1
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = shl nuw i32 1, %10
store volatile i32 %14, i32* inttoptr (i64 1074786328 to i32*)
br label %15
15: ; preds = %13, %2
%16 = and i32 %1, 2
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = shl nuw i32 1, %10
store volatile i32 %19, i32* inttoptr (i64 1074786352 to i32*)
br label %20
20: ; preds = %18, %15
%21 = and i32 %1, 4
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = shl nuw i32 1, %10
store volatile i32 %24, i32* inttoptr (i64 1074786360 to i32*)
br label %25
25: ; preds = %23, %20
%26 = and i32 %1, 8
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = shl nuw i32 1, %10
store volatile i32 %29, i32* inttoptr (i64 1074786336 to i32*)
br label %30
30: ; preds = %28, %25
ret void
}