#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*/ rtl_init();
int bb_init() {
  volatile unsigned char *const g28 = (volatile unsigned char *)(0xa1000000);
  volatile unsigned short *const g216 = (volatile unsigned short *)(0xa1000000);
  volatile unsigned long *const g232 = (volatile unsigned long *)(0xa1000000);
  int i;
  unsigned int tmp;
  g232[0x1418 / 4] = 0x5a14a501;
  i = 10000;
  while (!(g232[0x1418 / 4] & 1) && i > 0)
    i--;
  if (!(g232[0x1418 / 4] & 1)) {
    return -1;
  }
  g232[0x1420 / 4] = 0x01000000;
  g232[0x1424 / 4] = 0x01000000;
  g232[0x1428 / 4] = 0x01840000;
  g232[0x142c / 4] = 0x01840000 + 32 * 1024;
  g232[0x1414 / 4] = 0x00000001;
  g232[0x1434 / 4] = 0x00000001;
  g216[0x1606 / 2] = 0xf900;
  g232[0x1630 / 4] = 0x00000000;
  g28[0x163c] = 0x00;
  g28[0x160d] = 0xf0;
  (void)g216[0x04 / 2];
  g216[0x1604 / 2] = 0x0006;
  g232[0x1614 / 4] = 0x01000000;
  (void)g28[0x1650];
  rtl_init();
  return 0;
}


x86 assembly (clang, -O0):
<bb_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0xa1000000,%eax
mov    %rax,-0x10(%rbp)
mov    $0xa1000000,%eax
mov    %rax,-0x18(%rbp)
mov    $0xa1000000,%eax
mov    %rax,-0x20(%rbp)
mov    $0xa1000000,%eax
movq   $0x5a14a501,0x2830(%rax)
01 a5 14 5a
movl   $0x2710,-0x24(%rbp)
mov    $0xa1000000,%eax
mov    0x2830(%rax),%rcx
and    $0x1,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
jne    1173 <bb_init+0x63>
cmpl   $0x0,-0x24(%rbp)
setg   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1183 <bb_init+0x73>
jmp    1191 <bb_init+0x81>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    114a <bb_init+0x3a>
mov    $0xa1000000,%eax
mov    0x2830(%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    11b7 <bb_init+0xa7>
movl   $0xffffffff,-0x4(%rbp)
jmp    128d <bb_init+0x17d>
mov    $0xa1000000,%eax
movq   $0x1000000,0x2840(%rax)
mov    $0xa1000000,%eax
movq   $0x1000000,0x2848(%rax)
mov    $0xa1000000,%eax
movq   $0x1840000,0x2850(%rax)
mov    $0xa1000000,%eax
movq   $0x1848000,0x2858(%rax)
mov    $0xa1000000,%eax
movq   $0x1,0x2828(%rax)
mov    $0xa1000000,%eax
movq   $0x1,0x2868(%rax)
mov    $0xa1000000,%eax
movw   $0xf900,0x1606(%rax)
mov    $0xa1000000,%eax
movq   $0x0,0x2c60(%rax)
mov    $0xa1000000,%eax
movb   $0x0,0x163c(%rax)
mov    $0xa1000000,%eax
movb   $0xf0,0x160d(%rax)
mov    $0xa1000000,%eax
mov    0x4(%rax),%ax
mov    $0xa1000000,%eax
movw   $0x6,0x1604(%rax)
mov    $0xa1000000,%eax
movq   $0x1000000,0x2c28(%rax)
mov    $0xa1000000,%eax
mov    0x1650(%rax),%al
mov    $0x0,%al
call   1030 <rtl_init@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bb_init>:
push   %rbx
mov    $0xa1002830,%eax
movq   $0x5a14a501,(%rax)
mov    $0xffffd8f0,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rax),%rdx
test   $0x1,%dl
jne    1141 <bb_init+0x31>
lea    0x1(%rcx),%edx
test   %ecx,%ecx
mov    %edx,%ecx
jne    1130 <bb_init+0x20>
mov    $0xffffffff,%ebx
testq  $0x1,(%rax)
je     11cb <bb_init+0xbb>
movq   $0x1000000,0x10(%rax)
01
movq   $0x1000000,0x18(%rax)
01
movq   $0x1840000,0x20(%rax)
01
movq   $0x1848000,0x28(%rax)
01
movq   $0x1,-0x8(%rax)
movq   $0x1,0x38(%rax)
movw   $0xf900,-0x122a(%rax)
movq   $0x0,0x430(%rax)
movb   $0x0,-0x11f4(%rax)
movb   $0xf0,-0x1223(%rax)
movzwl -0x282c(%rax),%ecx
movw   $0x6,-0x122c(%rax)
movq   $0x1000000,0x3f8(%rax)
mov    -0x11e0(%rax),%al
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <rtl_init@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @bb_init() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i16*
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32
store i8* inttoptr (i64 2701131776 to i8*), i8** %2
store i16* inttoptr (i64 2701131776 to i16*), i16** %3
store i64* inttoptr (i64 2701131776 to i64*), i64** %4
store volatile i64 1511302401, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1286)
store i32 10000, i32* %5
br label %7
7: ; preds = %16, %0
%8 = load volatile i64, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1286)
%9 = and i64 %8, 1
%10 = icmp ne i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 0
br label %14
14: ; preds = %11, %7
%15 = phi i1 [ false, %7 ], [ %13, %11 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %7
19: ; preds = %14
%20 = load volatile i64, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1286)
%21 = and i64 %20, 1
%22 = icmp ne i64 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %19
store i32 -1, i32* %1
br label %28
24: ; preds = %19
store volatile i64 16777216, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1288)
store volatile i64 16777216, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1289)
store volatile i64 25427968, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1290)
store volatile i64 25460736, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1291)
store volatile i64 1, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1285)
store volatile i64 1, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1293)
store volatile i16 -1792, i16* getelementptr inbounds (i16, i16* inttoptr (i64 2701131776 to i16*), i64 2819)
store volatile i64 0, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1420)
store volatile i8 0, i8* getelementptr inbounds (i8, i8* inttoptr (i64 2701131776 to i8*), i64 5692)
store volatile i8 -16, i8* getelementptr inbounds (i8, i8* inttoptr (i64 2701131776 to i8*), i64 5645)
%25 = load volatile i16, i16* getelementptr inbounds (i16, i16* inttoptr (i64 2701131776 to i16*), i64 2)
store volatile i16 6, i16* getelementptr inbounds (i16, i16* inttoptr (i64 2701131776 to i16*), i64 2818)
store volatile i64 16777216, i64* getelementptr inbounds (i64, i64* inttoptr (i64 2701131776 to i64*), i64 1413)
%26 = load volatile i8, i8* getelementptr inbounds (i8, i8* inttoptr (i64 2701131776 to i8*), i64 5712)
%27 = call i32 (...) @rtl_init()
store i32 0, i32* %1
br label %28
28: ; preds = %24, %23
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
define i32 @bb_init() {
store volatile i64 1511302401, i64* inttoptr (i64 2701142064 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 10000, %0 ], [ %8, %1 ]
%3 = load volatile i64, i64* inttoptr (i64 2701142064 to i64*)
%4 = and i64 %3, 1
%5 = icmp eq i64 %4, 0
%6 = icmp ne i32 %2, 0
%7 = select i1 %5, i1 %6, i1 false
%8 = add nsw i32 %2, -1
br i1 %7, label %1, label %9
9: ; preds = %1
%10 = load volatile i64, i64* inttoptr (i64 2701142064 to i64*)
%11 = and i64 %10, 1
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
store volatile i64 16777216, i64* inttoptr (i64 2701142080 to i64*)
store volatile i64 16777216, i64* inttoptr (i64 2701142088 to i64*)
store volatile i64 25427968, i64* inttoptr (i64 2701142096 to i64*)
store volatile i64 25460736, i64* inttoptr (i64 2701142104 to i64*)
store volatile i64 1, i64* inttoptr (i64 2701142056 to i64*)
store volatile i64 1, i64* inttoptr (i64 2701142120 to i64*)
store volatile i16 -1792, i16* inttoptr (i64 2701137414 to i16*)
store volatile i64 0, i64* inttoptr (i64 2701143136 to i64*)
store volatile i8 0, i8* inttoptr (i64 2701137468 to i8*)
store volatile i8 -16, i8* inttoptr (i64 2701137421 to i8*)
%14 = load volatile i16, i16* inttoptr (i64 2701131780 to i16*)
store volatile i16 6, i16* inttoptr (i64 2701137412 to i16*)
store volatile i64 16777216, i64* inttoptr (i64 2701143080 to i64*)
%15 = load volatile i8, i8* inttoptr (i64 2701137488 to i8*)
%16 = tail call i32 (...) @rtl_init()
br label %17
17: ; preds = %9, %13
%18 = phi i32 [ 0, %13 ], [ -1, %9 ]
ret i32 %18
}