#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*/ ROM_FPUEnable();
void Reset_Handler(void) {
  extern int main(void);
  extern int __libc_init_array(void);
  extern unsigned __data_start;
  extern unsigned __data_end__;
  extern unsigned const __data_load;
  extern unsigned __bss_start__;
  extern unsigned __bss_end__;
  unsigned const *src;
  unsigned *dst;
  src = &__data_load;
  for (dst = &__data_start; dst < &__data_end__; ++dst, ++src) {
    *dst = *src;
  }
  for (dst = &__bss_start__; dst < &__bss_end__; ++dst) {
    *dst = 0;
  }
  __libc_init_array();
  ROM_FPUEnable();
  (void)main();
}


x86 assembly (clang, -O0):
<Reset_Handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2e8e(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e7b(%rip),%rax
cmp    %rax,-0x10(%rbp)
jae    1188 <Reset_Handler+0x58>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    114e <Reset_Handler+0x1e>
mov    0x2e31(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e2e(%rip),%rax
cmp    %rax,-0x10(%rbp)
jae    11bf <Reset_Handler+0x8f>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1193 <Reset_Handler+0x63>
call   1030 <__libc_init_array@plt>
mov    $0x0,%al
call   1040 <ROM_FPUEnable@plt>
call   1050 <main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Reset_Handler>:
push   %rax
mov    0x2e80(%rip),%rdi
cmp    0x2e71(%rip),%rdi
jae    1191 <Reset_Handler+0x41>
lea    0x4(%rdi),%rax
mov    0x2e64(%rip),%rcx
cmp    %rax,%rcx
cmova  %rcx,%rax
mov    %rdi,%rcx
not    %rcx
lea    (%rcx,%rax,1),%rdx
add    $0x4,%rdx
and    $0xfffffffffffffffc,%rdx
mov    0x2e5c(%rip),%rsi
call   1050 <memcpy@plt>
mov    0x2e28(%rip),%rdi
cmp    0x2e29(%rip),%rdi
jae    11cc <Reset_Handler+0x7c>
lea    0x4(%rdi),%rax
mov    0x2e1c(%rip),%rcx
cmp    %rax,%rcx
cmova  %rcx,%rax
mov    %rdi,%rcx
not    %rcx
lea    (%rcx,%rax,1),%rdx
add    $0x4,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %esi,%esi
call   1040 <memset@plt>
call   1030 <__libc_init_array@plt>
xor    %eax,%eax
call   1060 <ROM_FPUEnable@plt>
pop    %rax
jmp    1070 <main@plt>

LLVM IR (-O0):
@__data_load = external constant i32
@__data_start = external global i32
@__data_end__ = external global i32
@__bss_start__ = external global i32
@__bss_end__ = external global i32
define void @Reset_Handler() {
%1 = alloca i32*
%2 = alloca i32*
store i32* @__data_load, i32** %1
store i32* @__data_start, i32** %2
br label %3
3: ; preds = %10, %0
%4 = load i32*, i32** %2
%5 = icmp ult i32* %4, @__data_end__
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = load i32*, i32** %1
%8 = load i32, i32* %7
%9 = load i32*, i32** %2
store i32 %8, i32* %9
br label %10
10: ; preds = %6
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i32 1
store i32* %12, i32** %2
%13 = load i32*, i32** %1
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %1
br label %3
15: ; preds = %3
store i32* @__bss_start__, i32** %2
br label %16
16: ; preds = %21, %15
%17 = load i32*, i32** %2
%18 = icmp ult i32* %17, @__bss_end__
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32*, i32** %2
store i32 0, i32* %20
br label %21
21: ; preds = %19
%22 = load i32*, i32** %2
%23 = getelementptr inbounds i32, i32* %22, i32 1
store i32* %23, i32** %2
br label %16
24: ; preds = %16
%25 = call i32 @__libc_init_array()
%26 = call i32 (...) @ROM_FPUEnable()
%27 = call i32 @main()
ret void
}

LLVM IR (-O2):
@__data_load = external constant i32
@__data_start = external global i32
@__data_end__ = external global i32
@__bss_start__ = external global i32
@__bss_end__ = external global i32
define void @Reset_Handler() {
br i1 icmp ult (i32* @__data_start, i32* @__data_end__), label %1, label %5
1: ; preds = %0
%2 = call i64 @llvm.umax.i64(i64 ptrtoint (i32* @__data_end__ to i64), i64 add (i64 ptrtoint (i32* @__data_start to i64), i64 4))
%3 = add i64 %2, add (i64 xor (i64 ptrtoint (i32* @__data_start to i64), i64 -1), i64 4)
%4 = and i64 %3, -4
br label %5
5: ; preds = %1, %0
br i1 icmp ult (i32* @__bss_start__, i32* @__bss_end__), label %6, label %10
6: ; preds = %5
%7 = call i64 @llvm.umax.i64(i64 ptrtoint (i32* @__bss_end__ to i64), i64 add (i64 ptrtoint (i32* @__bss_start__ to i64), i64 4))
%8 = add i64 %7, add (i64 xor (i64 ptrtoint (i32* @__bss_start__ to i64), i64 -1), i64 4)
%9 = and i64 %8, -4
br label %10
10: ; preds = %6, %5
%11 = tail call i32 @__libc_init_array()
%12 = tail call i32 (...) @ROM_FPUEnable()
%13 = tail call i32 @main()
ret void
}