void aica_reset() {
  int i, j;
  volatile unsigned int *hwptr =
      ((volatile unsigned int *)(void *)(0x800000 + (0)));
  *((volatile unsigned int *)(void *)(0x800000 + (0x2800))) = 0;
  for (i = 0; i < 64; i++) {
    hwptr[0] = 0x8000;
    hwptr[5] = 0x1f;
    hwptr[1] = 0;
    hwptr[2] = 0;
    hwptr[3] = 0;
    hwptr[4] = 0;
    for (j = 6; j < 32; j++)
      hwptr[j] = 0;
    hwptr += 32;
  }
  *((volatile unsigned int *)(void *)(0x800000 + (0x2040))) = 0x0f0f;
  *((volatile unsigned int *)(void *)(0x800000 + (0x2044))) = 0x0f1f;
  *((volatile unsigned int *)(void *)(0x800000 + (0x2800))) = 15;
}


x86 assembly (clang, -O0):
<aica_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x800000,%eax
mov    %rax,-0x10(%rbp)
mov    $0x802800,%eax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    11b4 <aica_reset+0xb4>
mov    -0x10(%rbp),%rax
movl   $0x8000,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1f,0x14(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0xc(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x10(%rax)
movl   $0x6,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    1198 <aica_reset+0x98>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1171 <aica_reset+0x71>
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <aica_reset+0x1f>
mov    $0x802040,%eax
movl   $0xf0f,(%rax)
mov    $0x802044,%eax
movl   $0xf1f,(%rax)
mov    $0x802800,%eax
movl   $0xf,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<aica_reset>:
movl   $0x0,0x802800
mov    $0x800000,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x8000,0x800000(%rcx)
movl   $0x1f,0x14(%rax)
movl   $0x0,0x4(%rax)
movl   $0x0,0x8(%rax)
movl   $0x0,0xc(%rax)
movl   $0x0,0x10(%rax)
movl   $0x0,0x18(%rax)
movl   $0x0,0x1c(%rax)
movl   $0x0,0x20(%rax)
movl   $0x0,0x24(%rax)
movl   $0x0,0x28(%rax)
movl   $0x0,0x2c(%rax)
movl   $0x0,0x30(%rax)
movl   $0x0,0x34(%rax)
movl   $0x0,0x38(%rax)
movl   $0x0,0x3c(%rax)
movl   $0x0,0x40(%rax)
movl   $0x0,0x44(%rax)
movl   $0x0,0x48(%rax)
movl   $0x0,0x4c(%rax)
movl   $0x0,0x50(%rax)
movl   $0x0,0x54(%rax)
movl   $0x0,0x58(%rax)
movl   $0x0,0x5c(%rax)
movl   $0x0,0x60(%rax)
movl   $0x0,0x64(%rax)
movl   $0x0,0x68(%rax)
movl   $0x0,0x6c(%rax)
movl   $0x0,0x70(%rax)
movl   $0x0,0x74(%rax)
movl   $0x0,0x78(%rax)
movl   $0x0,0x7c(%rax)
sub    $0xffffffffffffff80,%rax
sub    $0xffffffffffffff80,%rcx
cmp    $0x2000,%ecx
jne    1120 <aica_reset+0x20>
movl   $0xf0f,0x802040
movl   $0xf1f,0x802044
movl   $0xf,0x802800
ret

LLVM IR (-O0):
define void @aica_reset() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32* inttoptr (i64 8388608 to i32*), i32** %3
store volatile i32 0, i32* inttoptr (i64 8398848 to i32*)
store i32 0, i32* %1
br label %4
4: ; preds = %34, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 64
br i1 %6, label %7, label %37
7: ; preds = %4
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
store volatile i32 32768, i32* %9
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 5
store volatile i32 31, i32* %11
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 1
store volatile i32 0, i32* %13
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 2
store volatile i32 0, i32* %15
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 3
store volatile i32 0, i32* %17
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 4
store volatile i32 0, i32* %19
store i32 6, i32* %2
br label %20
20: ; preds = %28, %7
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 32
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i32*, i32** %3
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
store volatile i32 0, i32* %27
br label %28
28: ; preds = %23
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %20
31: ; preds = %20
%32 = load i32*, i32** %3
%33 = getelementptr inbounds i32, i32* %32, i64 32
store i32* %33, i32** %3
br label %34
34: ; preds = %31
%35 = load i32, i32* %1
%36 = add nsw i32 %35, 1
store i32 %36, i32* %1
br label %4
37: ; preds = %4
store volatile i32 3855, i32* inttoptr (i64 8396864 to i32*)
store volatile i32 3871, i32* inttoptr (i64 8396868 to i32*)
store volatile i32 15, i32* inttoptr (i64 8398848 to i32*)
ret void
}

LLVM IR (-O2):
define void @aica_reset() {
store volatile i32 0, i32* inttoptr (i64 8398848 to i32*)
br label %1
1: ; preds = %0, %1
%2 = phi i32* [ inttoptr (i64 8388608 to i32*), %0 ], [ %35, %1 ]
%3 = phi i32 [ 0, %0 ], [ %36, %1 ]
store volatile i32 32768, i32* %2
%4 = getelementptr inbounds i32, i32* %2, i64 5
store volatile i32 31, i32* %4
%5 = getelementptr inbounds i32, i32* %2, i64 1
store volatile i32 0, i32* %5
%6 = getelementptr inbounds i32, i32* %2, i64 2
store volatile i32 0, i32* %6
%7 = getelementptr inbounds i32, i32* %2, i64 3
store volatile i32 0, i32* %7
%8 = getelementptr inbounds i32, i32* %2, i64 4
store volatile i32 0, i32* %8
%9 = getelementptr inbounds i32, i32* %2, i64 6
store volatile i32 0, i32* %9
%10 = getelementptr inbounds i32, i32* %2, i64 7
store volatile i32 0, i32* %10
%11 = getelementptr inbounds i32, i32* %2, i64 8
store volatile i32 0, i32* %11
%12 = getelementptr inbounds i32, i32* %2, i64 9
store volatile i32 0, i32* %12
%13 = getelementptr inbounds i32, i32* %2, i64 10
store volatile i32 0, i32* %13
%14 = getelementptr inbounds i32, i32* %2, i64 11
store volatile i32 0, i32* %14
%15 = getelementptr inbounds i32, i32* %2, i64 12
store volatile i32 0, i32* %15
%16 = getelementptr inbounds i32, i32* %2, i64 13
store volatile i32 0, i32* %16
%17 = getelementptr inbounds i32, i32* %2, i64 14
store volatile i32 0, i32* %17
%18 = getelementptr inbounds i32, i32* %2, i64 15
store volatile i32 0, i32* %18
%19 = getelementptr inbounds i32, i32* %2, i64 16
store volatile i32 0, i32* %19
%20 = getelementptr inbounds i32, i32* %2, i64 17
store volatile i32 0, i32* %20
%21 = getelementptr inbounds i32, i32* %2, i64 18
store volatile i32 0, i32* %21
%22 = getelementptr inbounds i32, i32* %2, i64 19
store volatile i32 0, i32* %22
%23 = getelementptr inbounds i32, i32* %2, i64 20
store volatile i32 0, i32* %23
%24 = getelementptr inbounds i32, i32* %2, i64 21
store volatile i32 0, i32* %24
%25 = getelementptr inbounds i32, i32* %2, i64 22
store volatile i32 0, i32* %25
%26 = getelementptr inbounds i32, i32* %2, i64 23
store volatile i32 0, i32* %26
%27 = getelementptr inbounds i32, i32* %2, i64 24
store volatile i32 0, i32* %27
%28 = getelementptr inbounds i32, i32* %2, i64 25
store volatile i32 0, i32* %28
%29 = getelementptr inbounds i32, i32* %2, i64 26
store volatile i32 0, i32* %29
%30 = getelementptr inbounds i32, i32* %2, i64 27
store volatile i32 0, i32* %30
%31 = getelementptr inbounds i32, i32* %2, i64 28
store volatile i32 0, i32* %31
%32 = getelementptr inbounds i32, i32* %2, i64 29
store volatile i32 0, i32* %32
%33 = getelementptr inbounds i32, i32* %2, i64 30
store volatile i32 0, i32* %33
%34 = getelementptr inbounds i32, i32* %2, i64 31
store volatile i32 0, i32* %34
%35 = getelementptr inbounds i32, i32* %2, i64 32
%36 = add nuw nsw i32 %3, 1
%37 = icmp eq i32 %36, 64
br i1 %37, label %38, label %1
38: ; preds = %1
store volatile i32 3855, i32* inttoptr (i64 8396864 to i32*)
store volatile i32 3871, i32* inttoptr (i64 8396868 to i32*)
store volatile i32 15, i32* inttoptr (i64 8398848 to i32*)
ret void
}