#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);
int /*<<< orphan*/ SysCtlDelay(int);
void OneWireDMAEnable(uint32_t ui32Base, uint32_t ui32DMAFlags) {
  ASSERT(ui32Base == 0x400B6000);
  ASSERT(ui32DMAFlags > 0);
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) =
      (((*((volatile uint32_t *)(ui32Base + 0x00000000))) &
        ~((0x00000006 | 0x00000018 | 0x00070000))) |
       (ui32DMAFlags >> 8));
  (*((volatile uint32_t *)(ui32Base + 0x00000120))) = (ui32DMAFlags & 0xf);
  if ((ui32DMAFlags & (0x00000002 | 0x00000006)) &&
      !(ui32DMAFlags & 0x00000008)) {
    if ((((*((volatile uint32_t *)(0x400FE000))) & (0x70000000 | 0x00FF0000)) ==
         (0x10000000 | 0x000A0000))) {
      SysCtlDelay(9);
    }
    (*((volatile uint32_t *)(ui32Base + 0x00000008))) = 0xffffffff;
  }
}


x86 assembly (clang, -O0):
<OneWireDMAEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x400b6000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0xfff8ffe1,%ecx
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
or     %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
and    $0xf,%ecx
mov    -0x4(%rbp),%eax
add    $0x120,%eax
cltq
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x6,%eax
cmp    $0x0,%eax
je     11d4 <OneWireDMAEnable+0xb4>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    11d4 <OneWireDMAEnable+0xb4>
mov    $0x400fe000,%eax
mov    (%rax),%eax
and    $0x70ff0000,%eax
cmp    $0x100a0000,%eax
jne    11c6 <OneWireDMAEnable+0xa6>
mov    $0x9,%edi
call   1030 <SysCtlDelay@plt>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
movl   $0xffffffff,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OneWireDMAEnable>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x400b6000,%ebp
sete   %dil
call   1040 <ASSERT@plt>
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
call   1040 <ASSERT@plt>
movslq %ebp,%rbp
mov    $0xfff8ffe1,%eax
and    0x0(%rbp),%eax
mov    %ebx,%ecx
sar    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,0x0(%rbp)
mov    %ebx,%eax
and    $0xf,%eax
mov    %eax,0x120(%rbp)
test   $0x6,%bl
je     1193 <OneWireDMAEnable+0x73>
and    $0x8,%ebx
jne    1193 <OneWireDMAEnable+0x73>
mov    $0x70ff0000,%eax
and    0x400fe000,%eax
cmp    $0x100a0000,%eax
jne    118c <OneWireDMAEnable+0x6c>
mov    $0x9,%edi
call   1030 <SysCtlDelay@plt>
movl   $0xffffffff,0x8(%rbp)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @OneWireDMAEnable(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 = icmp eq i32 %5, 1074487296
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 0
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, -458783
%19 = load i32, i32* %4
%20 = ashr i32 %19, 8
%21 = or i32 %18, %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 0
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
store volatile i32 %21, i32* %25
%26 = load i32, i32* %4
%27 = and i32 %26, 15
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 288
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i32*
store volatile i32 %27, i32* %31
%32 = load i32, i32* %4
%33 = and i32 %32, 6
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %50
35: ; preds = %2
%36 = load i32, i32* %4
%37 = and i32 %36, 8
%38 = icmp ne i32 %37, 0
br i1 %38, label %50, label %39
39: ; preds = %35
%40 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%41 = and i32 %40, 1895759872
%42 = icmp eq i32 %41, 269090816
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 @SysCtlDelay(i32 9)
br label %45
45: ; preds = %43, %39
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 8
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
store volatile i32 -1, i32* %49
br label %50
50: ; preds = %45, %35, %2
ret void
}

LLVM IR (-O2):
define void @OneWireDMAEnable(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074487296
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = icmp sgt i32 %1, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @ASSERT(i32 %7)
%9 = sext i32 %0 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = and i32 %11, -458783
%13 = ashr i32 %1, 8
%14 = or i32 %12, %13
store volatile i32 %14, i32* %10
%15 = and i32 %1, 15
%16 = add nsw i32 %0, 288
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
store volatile i32 %15, i32* %18
%19 = and i32 %1, 6
%20 = icmp ne i32 %19, 0
%21 = and i32 %1, 8
%22 = icmp eq i32 %21, 0
%23 = and i1 %20, %22
br i1 %23, label %24, label %34
24: ; preds = %2
%25 = load volatile i32, i32* inttoptr (i64 1074782208 to i32*)
%26 = and i32 %25, 1895759872
%27 = icmp eq i32 %26, 269090816
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = tail call i32 @SysCtlDelay(i32 9)
br label %30
30: ; preds = %28, %24
%31 = add nsw i32 %0, 8
%32 = sext i32 %31 to i64
%33 = inttoptr i64 %32 to i32*
store volatile i32 -1, i32* %33
br label %34
34: ; preds = %30, %2
ret void
}