void DMA_Reset_All() {
  int i;
  for (i = 0; i <= 14; ++i)
    *(volatile int *)((volatile void *)(0x20007000) + (i)*0x100 + 0x00) = 1
                                                                          << 31;
  int Reset = 0;
  while (Reset != 0x7fff) {
    for (i = 0; i <= 14; ++i) {
      if (Reset & (1 << i))
        continue;
      if ((*(volatile int *)((volatile void *)(0x20007000) + (i)*0x100 + 0x00) &
           1 << 31) == 0)
        Reset |= (1 << i);
    }
  }
}


x86 assembly (clang, -O0):
<DMA_Reset_All>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xe,-0x4(%rbp)
jg     1138 <DMA_Reset_All+0x38>
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
movslq %eax,%rcx
mov    $0x20007000,%eax
movl   $0x80000000,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <DMA_Reset_All+0xb>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7fff,-0x8(%rbp)
je     11c3 <DMA_Reset_All+0xc3>
movl   $0x0,-0x4(%rbp)
cmpl   $0xe,-0x4(%rbp)
jg     11be <DMA_Reset_All+0xbe>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     117c <DMA_Reset_All+0x7c>
jmp    11b0 <DMA_Reset_All+0xb0>
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
movslq %eax,%rcx
mov    $0x20007000,%eax
mov    (%rax,%rcx,1),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
jne    11ab <DMA_Reset_All+0xab>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <DMA_Reset_All+0xb0>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <DMA_Reset_All+0x53>
jmp    113f <DMA_Reset_All+0x3f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DMA_Reset_All>:
movl   $0x80000000,0x20007000
movl   $0x80000000,0x20007100
movl   $0x80000000,0x20007200
movl   $0x80000000,0x20007300
movl   $0x80000000,0x20007400
movl   $0x80000000,0x20007500
movl   $0x80000000,0x20007600
movl   $0x80000000,0x20007700
movl   $0x80000000,0x20007800
movl   $0x80000000,0x20007900
movl   $0x80000000,0x20007a00
movl   $0x80000000,0x20007b00
movl   $0x80000000,0x20007c00
movl   $0x80000000,0x20007d00
movl   $0x80000000,0x20007e00
xor    %eax,%eax
xor    %ecx,%ecx
xor    %edx,%edx
jmp    11ba <DMA_Reset_All+0xba>
nopl   (%rax)
add    $0x1,%rcx
cmp    $0xf,%rcx
je     11e0 <DMA_Reset_All+0xe0>
mov    $0x1,%esi
shl    %cl,%esi
bt     %ecx,%edx
jb     11b0 <DMA_Reset_All+0xb0>
mov    %rcx,%rdi
shl    $0x8,%rdi
cmpl   $0x0,0x20007000(%rdi)
cmovs  %eax,%esi
or     %esi,%edx
jmp    11b0 <DMA_Reset_All+0xb0>
nopl   0x0(%rax,%rax,1)
mov    $0x0,%ecx
cmp    $0x7fff,%edx
jne    11ba <DMA_Reset_All+0xba>
ret

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

LLVM IR (-O2):
define void @DMA_Reset_All() {
store volatile i32 -2147483648, i32* inttoptr (i64 536899584 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536899840 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536900096 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536900352 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536900608 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536900864 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536901120 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536901376 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536901632 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536901888 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536902144 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536902400 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536902656 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536902912 to i32*)
store volatile i32 -2147483648, i32* inttoptr (i64 536903168 to i32*)
br label %3
1: ; preds = %18
%2 = icmp eq i32 %19, 32767
br i1 %2, label %24, label %22
3: ; preds = %22, %0
%4 = phi i64 [ 0, %0 ], [ %23, %22 ]
%5 = phi i32 [ 0, %0 ], [ %19, %22 ]
%6 = trunc i64 %4 to i32
%7 = shl nuw nsw i32 1, %6
%8 = and i32 %5, %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = shl nuw nsw i64 %4, 8
%12 = getelementptr i8, i8* inttoptr (i64 536899584 to i8*), i64 %11
%13 = bitcast i8* %12 to i32*
%14 = load volatile i32, i32* %13
%15 = icmp slt i32 %14, 0
%16 = select i1 %15, i32 0, i32 %7
%17 = or i32 %16, %5
br label %18
18: ; preds = %10, %3
%19 = phi i32 [ %5, %3 ], [ %17, %10 ]
%20 = add nuw nsw i64 %4, 1
%21 = icmp eq i64 %20, 15
br i1 %21, label %1, label %22
22: ; preds = %18, %1
%23 = phi i64 [ %20, %18 ], [ 0, %1 ]
br label %3
24: ; preds = %1
ret void
}