#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__;
  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;
  }
  __libc_init_array();
  (void)main();
  assert_failed("Reset_Handler", 304);
}


x86 assembly (clang, -O0):
<Reset_Handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <SystemInit@plt>
mov    0x2e92(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2e77(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e64(%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    0x2e1a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e17(%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>
call   1040 <__libc_init_array@plt>
call   1050 <main@plt>
lea    0xe19(%rip),%rdi
mov    $0x130,%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    0x2e69(%rip),%rdi
cmp    0x2e5a(%rip),%rdi
jae    11a8 <Reset_Handler+0x48>
lea    0x4(%rdi),%rax
mov    0x2e4d(%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    0x2e45(%rip),%rsi
call   1060 <memcpy@plt>
mov    0x2e11(%rip),%rdi
cmp    0x2e12(%rip),%rdi
jae    11e3 <Reset_Handler+0x83>
lea    0x4(%rdi),%rax
mov    0x2e05(%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>
call   1040 <__libc_init_array@plt>
call   1070 <main@plt>
lea    0xe0c(%rip),%rdi
mov    $0x130,%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
%26 = call i32 @__libc_init_array()
%27 = call i32 @main()
%28 = call i32 @assert_failed(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 304)
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
%12 = tail call i32 @__libc_init_array()
%13 = tail call i32 @main()
%14 = tail call i32 @assert_failed(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 304)
ret void
}