#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*/ main();
void _start2(void) {
  {
    extern int __VAL_START;
    extern int __DATA_START;
    extern int __DATA_END;
    char *src = (char *)&__VAL_START;
    char *dst = (char *)&__DATA_START;
    while (dst < (char *)&__DATA_END) {
      *dst++ = *src++;
    }
  }
  {
    extern int __BSS_START;
    extern int __BSS_END;
    char *dst = (char *)&__BSS_START;
    while (dst < (char *)&__BSS_END) {
      *dst++ = 0;
    }
  }
  main();
  while (1)
    ;
}


x86 assembly (clang, -O0):
<_start2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2ebe(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ea3(%rip),%rax
cmp    %rax,-0x10(%rbp)
jae    1166 <_start2+0x56>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    112e <_start2+0x1e>
mov    0x2e5b(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e48(%rip),%rax
cmp    %rax,-0x18(%rbp)
jae    1199 <_start2+0x89>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
jmp    1171 <_start2+0x61>
mov    $0x0,%al
call   1030 <main@plt>
jmp    11a0 <_start2+0x90>

x86 assembly (clang, -O2):
<_start2>:
push   %rax
mov    0x2eb0(%rip),%rdi
cmp    0x2e99(%rip),%rdi
jae    1162 <_start2+0x32>
lea    0x1(%rdi),%rdx
mov    0x2e8c(%rip),%rax
cmp    %rdx,%rax
cmova  %rax,%rdx
sub    %rdi,%rdx
mov    0x2e73(%rip),%rsi
call   1040 <memcpy@plt>
mov    0x2e5f(%rip),%rdi
cmp    0x2e50(%rip),%rdi
jae    118e <_start2+0x5e>
lea    0x1(%rdi),%rdx
mov    0x2e43(%rip),%rax
cmp    %rdx,%rax
cmova  %rax,%rdx
sub    %rdi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
xor    %eax,%eax
call   1050 <main@plt>
cs nopw 0x0(%rax,%rax,1)
nop
jmp    11a0 <_start2+0x70>

LLVM IR (-O0):
@__VAL_START = external global i32
@__DATA_START = external global i32
@__DATA_END = external global i32
@__BSS_START = external global i32
@__BSS_END = external global i32
define void @_start2() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
store i8* bitcast (i32* @__VAL_START to i8*), i8** %1
store i8* bitcast (i32* @__DATA_START to i8*), i8** %2
br label %4
4: ; preds = %7, %0
%5 = load i8*, i8** %2
%6 = icmp ult i8* %5, bitcast (i32* @__DATA_END to i8*)
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i8*, i8** %1
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %1
%10 = load i8, i8* %8
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
store i8 %10, i8* %11
br label %4
13: ; preds = %4
store i8* bitcast (i32* @__BSS_START to i8*), i8** %3
br label %14
14: ; preds = %17, %13
%15 = load i8*, i8** %3
%16 = icmp ult i8* %15, bitcast (i32* @__BSS_END to i8*)
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
store i8 0, i8* %18
br label %14
20: ; preds = %14
%21 = call i32 (...) @main()
br label %22
22: ; preds = %20, %22
br label %22
}

LLVM IR (-O2):
@__VAL_START = external global i32
@__DATA_START = external global i32
@__DATA_END = external global i32
@__BSS_START = external global i32
@__BSS_END = external global i32
define void @_start2() {
br i1 icmp ult (i32* @__DATA_START, i32* @__DATA_END), label %1, label %4
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 1))
%3 = sub i64 %2, ptrtoint (i32* @__DATA_START to i64)
br label %4
4: ; preds = %1, %0
br i1 icmp ult (i32* @__BSS_START, i32* @__BSS_END), label %5, label %8
5: ; preds = %4
%6 = call i64 @llvm.umax.i64(i64 ptrtoint (i32* @__BSS_END to i64), i64 add (i64 ptrtoint (i32* @__BSS_START to i64), i64 1))
%7 = sub i64 %6, ptrtoint (i32* @__BSS_START to i64)
br label %8
8: ; preds = %5, %4
%9 = tail call i32 (...) @main()
br label %10
10: ; preds = %8, %10
br label %10
}