#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 */

/* Variables and functions */
int /*<<< orphan*/ rxTools();
void main() {
  *((unsigned int *)0x080FFFC0) = 0x20000000;
  *((unsigned int *)0x080FFFC4) = 0x20046500;
  *((unsigned int *)0x080FFFD0) = 0x2008CA00;
  *((unsigned int *)0x080FFFD4) = 0x200C4E00;
  *((unsigned int *)0x080FFFD8) = 0;
  unsigned char *src = (void *)0x20400000;
  unsigned char *dst = (void *)0x08000000;
  for (int i = 0; i < 320 * 1024; i++) {
    dst[i] = src[i];
  }
  *(unsigned int *)0x10000020 = 0;
  *(unsigned int *)0x10000020 = 0x340;
  rxTools();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x80fffc0,%eax
movl   $0x20000000,(%rax)
mov    $0x80fffc4,%eax
movl   $0x20046500,(%rax)
mov    $0x80fffd0,%eax
movl   $0x2008ca00,(%rax)
mov    $0x80fffd4,%eax
movl   $0x200c4e00,(%rax)
mov    $0x80fffd8,%eax
movl   $0x0,(%rax)
mov    $0x20400000,%eax
mov    %rax,-0x8(%rbp)
mov    $0x8000000,%eax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x50000,-0x14(%rbp)
jge    1199 <main+0x89>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1168 <main+0x58>
mov    $0x10000020,%eax
movl   $0x0,(%rax)
mov    $0x10000020,%eax
movl   $0x340,(%rax)
mov    $0x0,%al
call   1030 <rxTools@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x8000000,%eax
movl   $0x20000000,0x80fffc0
movl   $0x20046500,0x80fffc4
movl   $0x2008ca00,0x80fffd0
movl   $0x200c4e00,0x80fffd4
movl   $0x0,0x80fffd8
mov    $0x90,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movaps 0x183fff70(%rax,%rcx,1),%xmm0
18
movaps 0x183fff80(%rax,%rcx,1),%xmm1
18
movaps 0x183fff90(%rax,%rcx,1),%xmm2
18
movaps 0x183fffa0(%rax,%rcx,1),%xmm3
18
movaps %xmm0,-0x90(%rax,%rcx,1)
ff
movaps %xmm1,-0x80(%rax,%rcx,1)
movaps %xmm2,-0x70(%rax,%rcx,1)
movaps %xmm3,-0x60(%rax,%rcx,1)
movaps 0x183fffb0(%rax,%rcx,1),%xmm0
18
movaps 0x183fffc0(%rax,%rcx,1),%xmm1
18
movaps %xmm0,-0x50(%rax,%rcx,1)
movaps %xmm1,-0x40(%rax,%rcx,1)
movaps 0x183fffd0(%rax,%rcx,1),%xmm0
18
movaps 0x183fffe0(%rax,%rcx,1),%xmm1
18
movaps %xmm0,-0x30(%rax,%rcx,1)
movaps %xmm1,-0x20(%rax,%rcx,1)
movaps 0x183ffff0(%rax,%rcx,1),%xmm0
18
movaps 0x18400000(%rax,%rcx,1),%xmm1
18
movaps %xmm0,-0x10(%rax,%rcx,1)
movaps %xmm1,(%rax,%rcx,1)
add    $0xa0,%rcx
cmp    $0x50090,%rcx
jne    1160 <main+0x50>
movl   $0x340,0x10000020
xor    %eax,%eax
jmp    1030 <rxTools@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
store i32 536870912, i32* inttoptr (i64 135266240 to i32*)
store i32 537158912, i32* inttoptr (i64 135266244 to i32*)
store i32 537446912, i32* inttoptr (i64 135266256 to i32*)
store i32 537677312, i32* inttoptr (i64 135266260 to i32*)
store i32 0, i32* inttoptr (i64 135266264 to i32*)
store i8* inttoptr (i64 541065216 to i8*), i8** %1
store i8* inttoptr (i64 134217728 to i8*), i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %17, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 327680
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i8*, i8** %1
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 %12, i8* %16
br label %17
17: ; preds = %7
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %4
20: ; preds = %4
store i32 0, i32* inttoptr (i64 268435488 to i32*)
store i32 832, i32* inttoptr (i64 268435488 to i32*)
%21 = call i32 (...) @rxTools()
ret void
}

LLVM IR (-O2):
define void @main() {
store i32 536870912, i32* inttoptr (i64 135266240 to i32*)
store i32 537158912, i32* inttoptr (i64 135266244 to i32*)
store i32 537446912, i32* inttoptr (i64 135266256 to i32*)
store i32 537677312, i32* inttoptr (i64 135266260 to i32*)
store i32 0, i32* inttoptr (i64 135266264 to i32*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %57, %1 ]
%3 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %2
%4 = bitcast i8* %3 to <16 x i8>*
%5 = load <16 x i8>, <16 x i8>* %4
%6 = getelementptr inbounds i8, i8* %3, i64 16
%7 = bitcast i8* %6 to <16 x i8>*
%8 = load <16 x i8>, <16 x i8>* %7
%9 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %2
%10 = bitcast i8* %9 to <16 x i8>*
store <16 x i8> %5, <16 x i8>* %10
%11 = getelementptr inbounds i8, i8* %9, i64 16
%12 = bitcast i8* %11 to <16 x i8>*
store <16 x i8> %8, <16 x i8>* %12
%13 = add nuw nsw i64 %2, 32
%14 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %13
%15 = bitcast i8* %14 to <16 x i8>*
%16 = load <16 x i8>, <16 x i8>* %15
%17 = getelementptr inbounds i8, i8* %14, i64 16
%18 = bitcast i8* %17 to <16 x i8>*
%19 = load <16 x i8>, <16 x i8>* %18
%20 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %13
%21 = bitcast i8* %20 to <16 x i8>*
store <16 x i8> %16, <16 x i8>* %21
%22 = getelementptr inbounds i8, i8* %20, i64 16
%23 = bitcast i8* %22 to <16 x i8>*
store <16 x i8> %19, <16 x i8>* %23
%24 = add nuw nsw i64 %2, 64
%25 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %24
%26 = bitcast i8* %25 to <16 x i8>*
%27 = load <16 x i8>, <16 x i8>* %26
%28 = getelementptr inbounds i8, i8* %25, i64 16
%29 = bitcast i8* %28 to <16 x i8>*
%30 = load <16 x i8>, <16 x i8>* %29
%31 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %24
%32 = bitcast i8* %31 to <16 x i8>*
store <16 x i8> %27, <16 x i8>* %32
%33 = getelementptr inbounds i8, i8* %31, i64 16
%34 = bitcast i8* %33 to <16 x i8>*
store <16 x i8> %30, <16 x i8>* %34
%35 = add nuw nsw i64 %2, 96
%36 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %35
%37 = bitcast i8* %36 to <16 x i8>*
%38 = load <16 x i8>, <16 x i8>* %37
%39 = getelementptr inbounds i8, i8* %36, i64 16
%40 = bitcast i8* %39 to <16 x i8>*
%41 = load <16 x i8>, <16 x i8>* %40
%42 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %35
%43 = bitcast i8* %42 to <16 x i8>*
store <16 x i8> %38, <16 x i8>* %43
%44 = getelementptr inbounds i8, i8* %42, i64 16
%45 = bitcast i8* %44 to <16 x i8>*
store <16 x i8> %41, <16 x i8>* %45
%46 = add nuw nsw i64 %2, 128
%47 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %46
%48 = bitcast i8* %47 to <16 x i8>*
%49 = load <16 x i8>, <16 x i8>* %48
%50 = getelementptr inbounds i8, i8* %47, i64 16
%51 = bitcast i8* %50 to <16 x i8>*
%52 = load <16 x i8>, <16 x i8>* %51
%53 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %46
%54 = bitcast i8* %53 to <16 x i8>*
store <16 x i8> %49, <16 x i8>* %54
%55 = getelementptr inbounds i8, i8* %53, i64 16
%56 = bitcast i8* %55 to <16 x i8>*
store <16 x i8> %52, <16 x i8>* %56
%57 = add nuw nsw i64 %2, 160
%58 = icmp eq i64 %57, 327680
br i1 %58, label %59, label %1
59: ; preds = %1
store i32 832, i32* inttoptr (i64 268435488 to i32*)
%60 = tail call i32 (...) @rxTools()
ret void
}