#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 *)0x080FFFD8) = 0;
  unsigned int *buf = 0x20400000;
  unsigned int base = 0x67893421;
  unsigned int seed = 0x12756342;
  for (int i = 0; i < 400 * 1024 / 4; i++) {
    buf[i] ^= base;
    base += seed;
  }
  unsigned char *src = 0x20400000;
  unsigned char *dst = 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    $0x30,%rsp
mov    $0x80fffc0,%eax
movl   $0x20000000,(%rax)
mov    $0x80fffc4,%eax
movl   $0x20046500,(%rax)
mov    $0x80fffd8,%eax
movl   $0x0,(%rax)
mov    $0x20400000,%eax
mov    %rax,-0x8(%rbp)
movl   $0x67893421,-0xc(%rbp)
movl   $0x12756342,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x19000,-0x14(%rbp)
jge    118c <main+0x7c>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <main+0x47>
mov    $0x20400000,%eax
mov    %rax,-0x20(%rbp)
mov    $0x8000000,%eax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x50000,-0x2c(%rbp)
jge    11d6 <main+0xc6>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a5 <main+0x95>
mov    $0x10000020,%eax
movl   $0x0,(%rax)
mov    $0x10000020,%eax
movl   $0x340,(%rax)
mov    $0x0,%al
call   1030 <rxTools@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x20400000,%eax
movl   $0x20000000,0x80fffc0
movl   $0x20046500,0x80fffc4
movl   $0x0,0x80fffd8
movdqa 0xec2(%rip),%xmm0
mov    $0xc,%ecx
movdqa 0xec5(%rip),%xmm1
movdqa 0xecd(%rip),%xmm2
movdqa 0xed5(%rip),%xmm3
movdqa 0xedd(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm0,%xmm5
paddd  %xmm1,%xmm5
movdqa -0x30(%rax,%rcx,4),%xmm6
pxor   %xmm0,%xmm6
pxor   -0x20(%rax,%rcx,4),%xmm5
movdqa %xmm6,-0x30(%rax,%rcx,4)
movdqa %xmm5,-0x20(%rax,%rcx,4)
movdqa %xmm0,%xmm5
paddd  %xmm2,%xmm5
movdqa %xmm0,%xmm6
pxor   -0x10(%rax,%rcx,4),%xmm5
paddd  %xmm3,%xmm6
pxor   (%rax,%rcx,4),%xmm6
movdqa %xmm5,-0x10(%rax,%rcx,4)
movdqa %xmm6,(%rax,%rcx,4)
paddd  %xmm4,%xmm0
add    $0x10,%rcx
cmp    $0x1900c,%rcx
jne    1170 <main+0x60>
mov    $0x90,%ecx
movaps -0x90(%rax,%rcx,1),%xmm0
ff
movaps -0x80(%rax,%rcx,1),%xmm1
movdqa -0x70(%rax,%rcx,1),%xmm2
movdqa -0x60(%rax,%rcx,1),%xmm3
movaps %xmm0,-0x18400090(%rax,%rcx,1)
e7
movaps %xmm1,-0x18400080(%rax,%rcx,1)
e7
movdqa %xmm2,-0x18400070(%rax,%rcx,1)
movdqa %xmm3,-0x18400060(%rax,%rcx,1)
bf e7
movaps -0x50(%rax,%rcx,1),%xmm0
movaps -0x40(%rax,%rcx,1),%xmm1
movaps %xmm0,-0x18400050(%rax,%rcx,1)
e7
movaps %xmm1,-0x18400040(%rax,%rcx,1)
e7
movaps -0x30(%rax,%rcx,1),%xmm0
movaps -0x20(%rax,%rcx,1),%xmm1
movaps %xmm0,-0x18400030(%rax,%rcx,1)
e7
movaps %xmm1,-0x18400020(%rax,%rcx,1)
e7
movdqa -0x10(%rax,%rcx,1),%xmm0
movdqa (%rax,%rcx,1),%xmm1
movdqa %xmm0,-0x18400010(%rax,%rcx,1)
bf e7
movdqa %xmm1,-0x18400000(%rax,%rcx,1)
c0 e7
add    $0xa0,%rcx
cmp    $0x50090,%rcx
jne    11d0 <main+0xc0>
movl   $0x340,0x10000020
xor    %eax,%eax
jmp    1030 <rxTools@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32 536870912, i32* inttoptr (i64 135266240 to i32*)
store i32 537158912, i32* inttoptr (i64 135266244 to i32*)
store i32 0, i32* inttoptr (i64 135266264 to i32*)
store i32* inttoptr (i64 541065216 to i32*), i32** %1
store i32 1737045025, i32* %2
store i32 309683010, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %22, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 102400
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %2
%13 = load i32*, i32** %1
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = xor i32 %17, %12
store i32 %18, i32* %16
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = add i32 %20, %19
store i32 %21, i32* %2
br label %22
22: ; preds = %11
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %8
25: ; preds = %8
store i8* inttoptr (i64 541065216 to i8*), i8** %5
store i8* inttoptr (i64 134217728 to i8*), i8** %6
store i32 0, i32* %7
br label %26
26: ; preds = %39, %25
%27 = load i32, i32* %7
%28 = icmp slt i32 %27, 327680
br i1 %28, label %29, label %42
29: ; preds = %26
%30 = load i8*, i8** %5
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = load i8*, i8** %6
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 %34, i8* %38
br label %39
39: ; preds = %29
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %26
42: ; preds = %26
store i32 0, i32* inttoptr (i64 268435488 to i32*)
store i32 832, i32* inttoptr (i64 268435488 to i32*)
%43 = 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 0, i32* inttoptr (i64 135266264 to i32*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %28, %1 ]
%3 = phi <4 x i32> [ <i32 1737045025, i32 2046728035, i32 -1938556251, i32 -1628873241>, %0 ], [ %29, %1 ]
%4 = add <4 x i32> %3, <i32 1238732040, i32 1238732040, i32 1238732040, i32 1238732040>
%5 = getelementptr inbounds i32, i32* inttoptr (i64 541065216 to i32*), i64 %2
%6 = bitcast i32* %5 to <4 x i32>*
%7 = load <4 x i32>, <4 x i32>* %6
%8 = getelementptr inbounds i32, i32* %5, i64 4
%9 = bitcast i32* %8 to <4 x i32>*
%10 = load <4 x i32>, <4 x i32>* %9
%11 = xor <4 x i32> %7, %3
%12 = xor <4 x i32> %10, %4
%13 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> %11, <4 x i32>* %13
%14 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %14
%15 = or i64 %2, 8
%16 = add <4 x i32> %3, <i32 -1817503216, i32 -1817503216, i32 -1817503216, i32 -1817503216>
%17 = add <4 x i32> %3, <i32 -578771176, i32 -578771176, i32 -578771176, i32 -578771176>
%18 = getelementptr inbounds i32, i32* inttoptr (i64 541065216 to i32*), i64 %15
%19 = bitcast i32* %18 to <4 x i32>*
%20 = load <4 x i32>, <4 x i32>* %19
%21 = getelementptr inbounds i32, i32* %18, i64 4
%22 = bitcast i32* %21 to <4 x i32>*
%23 = load <4 x i32>, <4 x i32>* %22
%24 = xor <4 x i32> %20, %16
%25 = xor <4 x i32> %23, %17
%26 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %24, <4 x i32>* %26
%27 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %27
%28 = add nuw nsw i64 %2, 16
%29 = add <4 x i32> %3, <i32 659960864, i32 659960864, i32 659960864, i32 659960864>
%30 = icmp eq i64 %28, 102400
br i1 %30, label %31, label %1
31: ; preds = %1, %31
%32 = phi i64 [ %87, %31 ], [ 0, %1 ]
%33 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %32
%34 = bitcast i8* %33 to <16 x i8>*
%35 = load <16 x i8>, <16 x i8>* %34
%36 = getelementptr inbounds i8, i8* %33, i64 16
%37 = bitcast i8* %36 to <16 x i8>*
%38 = load <16 x i8>, <16 x i8>* %37
%39 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %32
%40 = bitcast i8* %39 to <16 x i8>*
store <16 x i8> %35, <16 x i8>* %40
%41 = getelementptr inbounds i8, i8* %39, i64 16
%42 = bitcast i8* %41 to <16 x i8>*
store <16 x i8> %38, <16 x i8>* %42
%43 = add nuw nsw i64 %32, 32
%44 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %43
%45 = bitcast i8* %44 to <16 x i8>*
%46 = load <16 x i8>, <16 x i8>* %45
%47 = getelementptr inbounds i8, i8* %44, i64 16
%48 = bitcast i8* %47 to <16 x i8>*
%49 = load <16 x i8>, <16 x i8>* %48
%50 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %43
%51 = bitcast i8* %50 to <16 x i8>*
store <16 x i8> %46, <16 x i8>* %51
%52 = getelementptr inbounds i8, i8* %50, i64 16
%53 = bitcast i8* %52 to <16 x i8>*
store <16 x i8> %49, <16 x i8>* %53
%54 = add nuw nsw i64 %32, 64
%55 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %54
%56 = bitcast i8* %55 to <16 x i8>*
%57 = load <16 x i8>, <16 x i8>* %56
%58 = getelementptr inbounds i8, i8* %55, i64 16
%59 = bitcast i8* %58 to <16 x i8>*
%60 = load <16 x i8>, <16 x i8>* %59
%61 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %54
%62 = bitcast i8* %61 to <16 x i8>*
store <16 x i8> %57, <16 x i8>* %62
%63 = getelementptr inbounds i8, i8* %61, i64 16
%64 = bitcast i8* %63 to <16 x i8>*
store <16 x i8> %60, <16 x i8>* %64
%65 = add nuw nsw i64 %32, 96
%66 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %65
%67 = bitcast i8* %66 to <16 x i8>*
%68 = load <16 x i8>, <16 x i8>* %67
%69 = getelementptr inbounds i8, i8* %66, i64 16
%70 = bitcast i8* %69 to <16 x i8>*
%71 = load <16 x i8>, <16 x i8>* %70
%72 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %65
%73 = bitcast i8* %72 to <16 x i8>*
store <16 x i8> %68, <16 x i8>* %73
%74 = getelementptr inbounds i8, i8* %72, i64 16
%75 = bitcast i8* %74 to <16 x i8>*
store <16 x i8> %71, <16 x i8>* %75
%76 = add nuw nsw i64 %32, 128
%77 = getelementptr inbounds i8, i8* inttoptr (i64 541065216 to i8*), i64 %76
%78 = bitcast i8* %77 to <16 x i8>*
%79 = load <16 x i8>, <16 x i8>* %78
%80 = getelementptr inbounds i8, i8* %77, i64 16
%81 = bitcast i8* %80 to <16 x i8>*
%82 = load <16 x i8>, <16 x i8>* %81
%83 = getelementptr inbounds i8, i8* inttoptr (i64 134217728 to i8*), i64 %76
%84 = bitcast i8* %83 to <16 x i8>*
store <16 x i8> %79, <16 x i8>* %84
%85 = getelementptr inbounds i8, i8* %83, i64 16
%86 = bitcast i8* %85 to <16 x i8>*
store <16 x i8> %82, <16 x i8>* %86
%87 = add nuw nsw i64 %32, 160
%88 = icmp eq i64 %87, 327680
br i1 %88, label %89, label %31
89: ; preds = %31
store i32 832, i32* inttoptr (i64 268435488 to i32*)
%90 = tail call i32 (...) @rxTools()
ret void
}