#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 */
void LCDIDDDMAWrite(uint32_t ui32Base, uint32_t ui32CS,
                    const uint32_t *pui32Data, uint32_t ui32Count) {
  ;
  ;
  ;
  ;
  (*((volatile uint32_t *)(ui32Base + 0x0000000C))) &= ~0x00000100;
  (*((volatile uint32_t *)(ui32Base + 0x00000044))) = (uint32_t)pui32Data;
  (*((volatile uint32_t *)(ui32Base + 0x00000048))) =
      ((uint32_t)pui32Data + (ui32Count * 2) - 4);
  if (!ui32CS) {
    (*((volatile uint32_t *)(ui32Base + 0x0000000C))) &= ~0x00000200;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x0000000C))) |= 0x00000200;
  }
  (*((volatile uint32_t *)(ui32Base + 0x0000000C))) |= 0x00000100;
}


x86 assembly (clang, -O0):
<LCDIDDDMAWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0x44,%eax
cltq
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    %eax,%ecx
sub    $0x4,%ecx
mov    -0x4(%rbp),%eax
add    $0x48,%eax
cltq
mov    %ecx,(%rax)
cmpl   $0x0,-0x8(%rbp)
jne    116f <LCDIDDDMAWrite+0x6f>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffdff,%ecx
mov    %ecx,(%rax)
jmp    1181 <LCDIDDDMAWrite+0x81>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%ecx
or     $0x200,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%ecx
or     $0x100,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDIDDDMAWrite>:
xor    %eax,%eax
test   %esi,%esi
setne  %al
movslq %edi,%rsi
andl   $0xfffffeff,0xc(%rsi)
mov    %edx,0x44(%rsi)
lea    (%rdx,%rcx,2),%ecx
add    $0xfffffffc,%ecx
mov    %ecx,0x48(%rsi)
mov    $0xfffffdff,%ecx
and    0xc(%rsi),%ecx
shl    $0x9,%eax
or     %ecx,%eax
mov    %eax,0xc(%rsi)
orl    $0x100,0xc(%rsi)
ret

LLVM IR (-O0):
define void @LCDIDDDMAWrite(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 12
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
%14 = and i32 %13, -257
store volatile i32 %14, i32* %12
%15 = load i32*, i32** %7
%16 = ptrtoint i32* %15 to i32
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 68
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store volatile i32 %16, i32* %20
%21 = load i32*, i32** %7
%22 = ptrtoint i32* %21 to i32
%23 = load i32, i32* %8
%24 = mul nsw i32 %23, 2
%25 = add nsw i32 %22, %24
%26 = sub nsw i32 %25, 4
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 72
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
store volatile i32 %26, i32* %30
%31 = load i32, i32* %6
%32 = icmp ne i32 %31, 0
br i1 %32, label %40, label %33
33: ; preds = %4
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 12
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to i32*
%38 = load volatile i32, i32* %37
%39 = and i32 %38, -513
store volatile i32 %39, i32* %37
br label %47
40: ; preds = %4
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 12
%43 = sext i32 %42 to i64
%44 = inttoptr i64 %43 to i32*
%45 = load volatile i32, i32* %44
%46 = or i32 %45, 512
store volatile i32 %46, i32* %44
br label %47
47: ; preds = %40, %33
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 12
%50 = sext i32 %49 to i64
%51 = inttoptr i64 %50 to i32*
%52 = load volatile i32, i32* %51
%53 = or i32 %52, 256
store volatile i32 %53, i32* %51
ret void
}

LLVM IR (-O2):
define void @LCDIDDDMAWrite(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = add nsw i32 %0, 12
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, -257
store volatile i32 %9, i32* %7
%10 = ptrtoint i32* %2 to i64
%11 = trunc i64 %10 to i32
%12 = add nsw i32 %0, 68
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
store volatile i32 %11, i32* %14
%15 = shl nsw i32 %3, 1
%16 = add i32 %11, -4
%17 = add i32 %16, %15
%18 = add nsw i32 %0, 72
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store volatile i32 %17, i32* %20
%21 = icmp eq i32 %1, 0
%22 = load volatile i32, i32* %7
%23 = and i32 %22, -513
%24 = select i1 %21, i32 0, i32 512
%25 = or i32 %23, %24
store volatile i32 %25, i32* %7
%26 = load volatile i32, i32* %7
%27 = or i32 %26, 256
store volatile i32 %27, i32* %7
ret void
}