#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;
struct DMAControlBlock {
  int dummy;
};

/* Variables and functions */
void DMALaunchRequest(uint8_t channel,
                      const struct DMAControlBlock *controlBlock) {
  *(uint32_t *)0x20007FF0 = 1;
  while ((*(((volatile uint32_t *)0x20007000) + ((channel) << 6) + (0x00))) & 1)
    ;
  *(((volatile uint32_t *)0x20007000) + ((channel) << 6) + (0x01)) =
      0x40000000 | (uint32_t)controlBlock;
  *(((volatile uint32_t *)0x20007000) + ((channel) << 6) + (0x00)) = 7;
}


x86 assembly (clang, -O0):
<DMALaunchRequest>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x20007ff0,%eax
movl   $0x1,(%rax)
mov    -0x4(%rbp),%eax
shl    $0x6,%eax
movslq %eax,%rcx
mov    $0x20007000,%eax
mov    (%rax,%rcx,4),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1138 <DMALaunchRequest+0x38>
jmp    1116 <DMALaunchRequest+0x16>
mov    -0x10(%rbp),%rax
mov    %eax,%edx
or     $0x40000000,%edx
mov    -0x4(%rbp),%eax
shl    $0x6,%eax
movslq %eax,%rcx
mov    $0x20007000,%eax
mov    %edx,0x4(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
shl    $0x6,%eax
movslq %eax,%rcx
mov    $0x20007000,%eax
movl   $0x7,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DMALaunchRequest>:
movl   $0x1,0x20007ff0
shl    $0x6,%edi
movslq %edi,%rax
lea    0x20007000(,%rax,4),%rax
20
nopl   0x0(%rax)
mov    (%rax),%ecx
test   $0x1,%cl
jne    1120 <DMALaunchRequest+0x20>
or     $0x40000000,%esi
mov    %esi,0x4(%rax)
movl   $0x7,(%rax)
ret

LLVM IR (-O0):
%struct.DMAControlBlock = type { i32 }
define void @DMALaunchRequest(i32 %0, %struct.DMAControlBlock* %1) {
%3 = alloca i32
%4 = alloca %struct.DMAControlBlock*
store i32 %0, i32* %3
store %struct.DMAControlBlock* %1, %struct.DMAControlBlock** %4
store i32 1, i32* inttoptr (i64 536903664 to i32*)
br label %5
5: ; preds = %14, %2
%6 = load i32, i32* %3
%7 = shl i32 %6, 6
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* inttoptr (i64 536899584 to i32*), i64 %8
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load volatile i32, i32* %10
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %5
br label %5
15: ; preds = %5
%16 = load %struct.DMAControlBlock*, %struct.DMAControlBlock** %4
%17 = ptrtoint %struct.DMAControlBlock* %16 to i32
%18 = or i32 1073741824, %17
%19 = load i32, i32* %3
%20 = shl i32 %19, 6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* inttoptr (i64 536899584 to i32*), i64 %21
%23 = getelementptr inbounds i32, i32* %22, i64 1
store volatile i32 %18, i32* %23
%24 = load i32, i32* %3
%25 = shl i32 %24, 6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* inttoptr (i64 536899584 to i32*), i64 %26
%28 = getelementptr inbounds i32, i32* %27, i64 0
store volatile i32 7, i32* %28
ret void
}

LLVM IR (-O2):
%struct.DMAControlBlock = type { i32 }
define void @DMALaunchRequest(i32 %0, %struct.DMAControlBlock* %1) {
store i32 1, i32* inttoptr (i64 536903664 to i32*)
%3 = shl i32 %0, 6
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* inttoptr (i64 536899584 to i32*), i64 %4
br label %6
6: ; preds = %6, %2
%7 = load volatile i32, i32* %5
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %6
10: ; preds = %6
%11 = ptrtoint %struct.DMAControlBlock* %1 to i64
%12 = trunc i64 %11 to i32
%13 = or i32 %12, 1073741824
%14 = getelementptr inbounds i32, i32* %5, i64 1
store volatile i32 %13, i32* %14
store volatile i32 7, i32* %5
ret void
}