#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*/ SystemInit();
int /*<<< orphan*/ assert_failed(char *, int);
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__;
  extern void software_init_hook(void) __attribute__((weak));
  unsigned const *src;
  unsigned *dst;
  SystemInit();
  src = &__data_load;
  for (dst = &__data_start; dst < &__data_end__; ++dst, ++src) {
    *dst = *src;
  }
  for (dst = &__bss_start__; dst < &__bss_end__; ++dst) {
    *dst = 0;
  }
  if (&software_init_hook != (void (*)(void))(0)) {
    software_init_hook();
  } else {
    __libc_init_array();
    (void)main();
  }
  assert_failed("Reset_Handler", 263);
}


x86 assembly (clang, -O0):
<Reset_Handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <SystemInit@plt>
mov    0x2e8a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2e6f(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e5c(%rip),%rax
cmp    %rax,-0x10(%rbp)
jae    119f <Reset_Handler+0x5f>
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    1165 <Reset_Handler+0x25>
mov    0x2e12(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e0f(%rip),%rax
cmp    %rax,-0x10(%rbp)
jae    11d6 <Reset_Handler+0x96>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    11aa <Reset_Handler+0x6a>
mov    0x2e0b(%rip),%rax
test   %rax,%rax
je     11f5 <Reset_Handler+0xb5>
jmp    11eb <Reset_Handler+0xab>
call   1070 <software_init_hook@plt>
jmp    11ff <Reset_Handler+0xbf>
call   1040 <__libc_init_array@plt>
call   1050 <main@plt>
lea    0xdfa(%rip),%rdi
mov    $0x107,%esi
call   1060 <assert_failed@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Reset_Handler>:
push   %rax
xor    %eax,%eax
call   1030 <SystemInit@plt>
mov    0x2e61(%rip),%rdi
cmp    0x2e52(%rip),%rdi
jae    11a8 <Reset_Handler+0x48>
lea    0x4(%rdi),%rax
mov    0x2e45(%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    0x2e3d(%rip),%rsi
call   1060 <memcpy@plt>
mov    0x2e09(%rip),%rdi
cmp    0x2e0a(%rip),%rdi
jae    11e3 <Reset_Handler+0x83>
lea    0x4(%rdi),%rax
mov    0x2dfd(%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   1050 <memset@plt>
cmpq   $0x0,0x2dfd(%rip)
je     11f4 <Reset_Handler+0x94>
call   1090 <software_init_hook@plt>
jmp    11fe <Reset_Handler+0x9e>
call   1040 <__libc_init_array@plt>
call   1070 <main@plt>
lea    0xdfb(%rip),%rdi
mov    $0x107,%esi
pop    %rax
jmp    1080 <assert_failed@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
@.str = [14 x i8] c"Reset_Handler\00"
define void @Reset_Handler() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32 (...) @SystemInit()
store i32* @__data_load, i32** %1
store i32* @__data_start, i32** %2
br label %4
4: ; preds = %11, %0
%5 = load i32*, i32** %2
%6 = icmp ult i32* %5, @__data_end__
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32*, i32** %1
%9 = load i32, i32* %8
%10 = load i32*, i32** %2
store i32 %9, i32* %10
br label %11
11: ; preds = %7
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i32 1
store i32* %13, i32** %2
%14 = load i32*, i32** %1
%15 = getelementptr inbounds i32, i32* %14, i32 1
store i32* %15, i32** %1
br label %4
16: ; preds = %4
store i32* @__bss_start__, i32** %2
br label %17
17: ; preds = %22, %16
%18 = load i32*, i32** %2
%19 = icmp ult i32* %18, @__bss_end__
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32*, i32** %2
store i32 0, i32* %21
br label %22
22: ; preds = %20
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i32 1
store i32* %24, i32** %2
br label %17
25: ; preds = %17
br i1 icmp ne (void ()* @software_init_hook, void ()* null), label %26, label %27
26: ; preds = %25
br label %30
27: ; preds = %25
%28 = call i32 @__libc_init_array()
%29 = call i32 @main()
br label %30
30: ; preds = %27, %26
%31 = call i32 @assert_failed(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 263)
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
@.str = [14 x i8] c"Reset_Handler\00"
define void @Reset_Handler() {
%1 = tail call i32 (...) @SystemInit()
br i1 icmp ult (i32* @__data_start, i32* @__data_end__), label %2, label %6
2: ; preds = %0
%3 = call i64 @llvm.umax.i64(i64 ptrtoint (i32* @__data_end__ to i64), i64 add (i64 ptrtoint (i32* @__data_start to i64), i64 4))
%4 = add i64 %3, add (i64 xor (i64 ptrtoint (i32* @__data_start to i64), i64 -1), i64 4)
%5 = and i64 %4, -4
br label %6
6: ; preds = %2, %0
br i1 icmp ult (i32* @__bss_start__, i32* @__bss_end__), label %7, label %11
7: ; preds = %6
%8 = call i64 @llvm.umax.i64(i64 ptrtoint (i32* @__bss_end__ to i64), i64 add (i64 ptrtoint (i32* @__bss_start__ to i64), i64 4))
%9 = add i64 %8, add (i64 xor (i64 ptrtoint (i32* @__bss_start__ to i64), i64 -1), i64 4)
%10 = and i64 %9, -4
br label %11
11: ; preds = %7, %6
br i1 icmp ne (void ()* @software_init_hook, void ()* null), label %12, label %13
12: ; preds = %11
tail call void @software_init_hook()
br label %16
13: ; preds = %11
%14 = tail call i32 @__libc_init_array()
%15 = tail call i32 @main()
br label %16
16: ; preds = %13, %12
%17 = tail call i32 @assert_failed(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 263)
ret void
}