#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 */
typedef int uint16_t;

/* Variables and functions */
void InitSD() {
  *(volatile uint16_t *)0x10006100 &= 0xF7FFu;
  *(volatile uint16_t *)0x10006100 &= 0xEFFFu;
  *(volatile uint16_t *)0x10006100 |= 0x402u;
  *(volatile uint16_t *)0x100060D8 =
      (*(volatile uint16_t *)0x100060D8 & 0xFFDD) | 2;
  *(volatile uint16_t *)0x10006100 &= 0xFFFFu;
  *(volatile uint16_t *)0x100060D8 &= 0xFFDFu;
  *(volatile uint16_t *)0x10006104 = 512;
  *(volatile uint16_t *)0x10006108 = 1;
  *(volatile uint16_t *)0x100060E0 &= 0xFFFEu;
  *(volatile uint16_t *)0x100060E0 |= 1u;
  *(volatile uint16_t *)0x10006020 |= 0x837f031d;
  *(volatile uint16_t *)0x10006022 |= 0x837f031d >> 16;
  *(volatile uint16_t *)0x100060FC |= 0xDBu;
  *(volatile uint16_t *)0x100060FE |= 0xDBu;
  *(volatile uint16_t *)0x10006002 &= 0xFFFCu;
  *(volatile uint16_t *)0x10006024 = 0x20;
  *(volatile uint16_t *)0x10006028 = 0x40EE;
  *(volatile uint16_t *)0x10006002 &= 0xFFFCu;
  *(volatile uint16_t *)0x10006026 = 512;
  *(volatile uint16_t *)0x10006008 = 0;
}


x86 assembly (clang, -O0):
<InitSD>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10006100,%eax
mov    (%rax),%ecx
and    $0xf7ff,%ecx
mov    $0x10006100,%eax
mov    %ecx,(%rax)
mov    $0x10006100,%eax
mov    (%rax),%ecx
and    $0xefff,%ecx
mov    $0x10006100,%eax
mov    %ecx,(%rax)
mov    $0x10006100,%eax
mov    (%rax),%ecx
or     $0x402,%ecx
mov    $0x10006100,%eax
mov    %ecx,(%rax)
mov    $0x100060d8,%eax
mov    (%rax),%ecx
and    $0xffdd,%ecx
or     $0x2,%ecx
mov    $0x100060d8,%eax
mov    %ecx,(%rax)
mov    $0x10006100,%eax
mov    (%rax),%ecx
and    $0xffff,%ecx
mov    $0x10006100,%eax
mov    %ecx,(%rax)
mov    $0x100060d8,%eax
mov    (%rax),%ecx
and    $0xffdf,%ecx
mov    $0x100060d8,%eax
mov    %ecx,(%rax)
mov    $0x10006104,%eax
movl   $0x200,(%rax)
mov    $0x10006108,%eax
movl   $0x1,(%rax)
mov    $0x100060e0,%eax
mov    (%rax),%ecx
and    $0xfffe,%ecx
mov    $0x100060e0,%eax
mov    %ecx,(%rax)
mov    $0x100060e0,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x100060e0,%eax
mov    %ecx,(%rax)
mov    $0x10006020,%eax
mov    (%rax),%ecx
or     $0x837f031d,%ecx
mov    $0x10006020,%eax
mov    %ecx,(%rax)
mov    $0x10006022,%eax
mov    (%rax),%ecx
or     $0x837f,%ecx
mov    $0x10006022,%eax
mov    %ecx,(%rax)
mov    $0x100060fc,%eax
mov    (%rax),%ecx
or     $0xdb,%ecx
mov    $0x100060fc,%eax
mov    %ecx,(%rax)
mov    $0x100060fe,%eax
mov    (%rax),%ecx
or     $0xdb,%ecx
mov    $0x100060fe,%eax
mov    %ecx,(%rax)
mov    $0x10006002,%eax
mov    (%rax),%ecx
and    $0xfffc,%ecx
mov    $0x10006002,%eax
mov    %ecx,(%rax)
mov    $0x10006024,%eax
movl   $0x20,(%rax)
mov    $0x10006028,%eax
movl   $0x40ee,(%rax)
mov    $0x10006002,%eax
mov    (%rax),%ecx
and    $0xfffc,%ecx
mov    $0x10006002,%eax
mov    %ecx,(%rax)
mov    $0x10006026,%eax
movl   $0x200,(%rax)
mov    $0x10006008,%eax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitSD>:
andl   $0xf7ff,0x10006100
andl   $0xefff,0x10006100
orl    $0x402,0x10006100
mov    $0xffdd,%eax
and    0x100060d8,%eax
or     $0x2,%eax
mov    %eax,0x100060d8
andl   $0xffff,0x10006100
andl   $0xffdf,0x100060d8
movl   $0x200,0x10006104
movl   $0x1,0x10006108
andl   $0xfffe,0x100060e0
orl    $0x1,0x100060e0
01
orl    $0x837f031d,0x10006020
1d 03 7f 83
orl    $0x837f,0x10006022
orl    $0xdb,0x100060fc
orl    $0xdb,0x100060fe
andl   $0xfffc,0x10006002
movl   $0x20,0x10006024
movl   $0x40ee,0x10006028
andl   $0xfffc,0x10006002
movl   $0x200,0x10006026
movl   $0x0,0x10006008
ret

LLVM IR (-O0):
define void @InitSD() {
%1 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%2 = and i32 %1, 63487
store volatile i32 %2, i32* inttoptr (i64 268460288 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%4 = and i32 %3, 61439
store volatile i32 %4, i32* inttoptr (i64 268460288 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%6 = or i32 %5, 1026
store volatile i32 %6, i32* inttoptr (i64 268460288 to i32*)
%7 = load volatile i32, i32* inttoptr (i64 268460248 to i32*)
%8 = and i32 %7, 65501
%9 = or i32 %8, 2
store volatile i32 %9, i32* inttoptr (i64 268460248 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%11 = and i32 %10, 65535
store volatile i32 %11, i32* inttoptr (i64 268460288 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 268460248 to i32*)
%13 = and i32 %12, 65503
store volatile i32 %13, i32* inttoptr (i64 268460248 to i32*)
store volatile i32 512, i32* inttoptr (i64 268460292 to i32*)
store volatile i32 1, i32* inttoptr (i64 268460296 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 268460256 to i32*)
%15 = and i32 %14, 65534
store volatile i32 %15, i32* inttoptr (i64 268460256 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 268460256 to i32*)
%17 = or i32 %16, 1
store volatile i32 %17, i32* inttoptr (i64 268460256 to i32*)
%18 = load volatile i32, i32* inttoptr (i64 268460064 to i32*)
%19 = or i32 %18, -2088828131
store volatile i32 %19, i32* inttoptr (i64 268460064 to i32*)
%20 = load volatile i32, i32* inttoptr (i64 268460066 to i32*)
%21 = or i32 %20, 33663
store volatile i32 %21, i32* inttoptr (i64 268460066 to i32*)
%22 = load volatile i32, i32* inttoptr (i64 268460284 to i32*)
%23 = or i32 %22, 219
store volatile i32 %23, i32* inttoptr (i64 268460284 to i32*)
%24 = load volatile i32, i32* inttoptr (i64 268460286 to i32*)
%25 = or i32 %24, 219
store volatile i32 %25, i32* inttoptr (i64 268460286 to i32*)
%26 = load volatile i32, i32* inttoptr (i64 268460034 to i32*)
%27 = and i32 %26, 65532
store volatile i32 %27, i32* inttoptr (i64 268460034 to i32*)
store volatile i32 32, i32* inttoptr (i64 268460068 to i32*)
store volatile i32 16622, i32* inttoptr (i64 268460072 to i32*)
%28 = load volatile i32, i32* inttoptr (i64 268460034 to i32*)
%29 = and i32 %28, 65532
store volatile i32 %29, i32* inttoptr (i64 268460034 to i32*)
store volatile i32 512, i32* inttoptr (i64 268460070 to i32*)
store volatile i32 0, i32* inttoptr (i64 268460040 to i32*)
ret void
}

LLVM IR (-O2):
define void @InitSD() {
%1 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%2 = and i32 %1, 63487
store volatile i32 %2, i32* inttoptr (i64 268460288 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%4 = and i32 %3, 61439
store volatile i32 %4, i32* inttoptr (i64 268460288 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%6 = or i32 %5, 1026
store volatile i32 %6, i32* inttoptr (i64 268460288 to i32*)
%7 = load volatile i32, i32* inttoptr (i64 268460248 to i32*)
%8 = and i32 %7, 65501
%9 = or i32 %8, 2
store volatile i32 %9, i32* inttoptr (i64 268460248 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 268460288 to i32*)
%11 = and i32 %10, 65535
store volatile i32 %11, i32* inttoptr (i64 268460288 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 268460248 to i32*)
%13 = and i32 %12, 65503
store volatile i32 %13, i32* inttoptr (i64 268460248 to i32*)
store volatile i32 512, i32* inttoptr (i64 268460292 to i32*)
store volatile i32 1, i32* inttoptr (i64 268460296 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 268460256 to i32*)
%15 = and i32 %14, 65534
store volatile i32 %15, i32* inttoptr (i64 268460256 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 268460256 to i32*)
%17 = or i32 %16, 1
store volatile i32 %17, i32* inttoptr (i64 268460256 to i32*)
%18 = load volatile i32, i32* inttoptr (i64 268460064 to i32*)
%19 = or i32 %18, -2088828131
store volatile i32 %19, i32* inttoptr (i64 268460064 to i32*)
%20 = load volatile i32, i32* inttoptr (i64 268460066 to i32*)
%21 = or i32 %20, 33663
store volatile i32 %21, i32* inttoptr (i64 268460066 to i32*)
%22 = load volatile i32, i32* inttoptr (i64 268460284 to i32*)
%23 = or i32 %22, 219
store volatile i32 %23, i32* inttoptr (i64 268460284 to i32*)
%24 = load volatile i32, i32* inttoptr (i64 268460286 to i32*)
%25 = or i32 %24, 219
store volatile i32 %25, i32* inttoptr (i64 268460286 to i32*)
%26 = load volatile i32, i32* inttoptr (i64 268460034 to i32*)
%27 = and i32 %26, 65532
store volatile i32 %27, i32* inttoptr (i64 268460034 to i32*)
store volatile i32 32, i32* inttoptr (i64 268460068 to i32*)
store volatile i32 16622, i32* inttoptr (i64 268460072 to i32*)
%28 = load volatile i32, i32* inttoptr (i64 268460034 to i32*)
%29 = and i32 %28, 65532
store volatile i32 %29, i32* inttoptr (i64 268460034 to i32*)
store volatile i32 512, i32* inttoptr (i64 268460070 to i32*)
store volatile i32 0, i32* inttoptr (i64 268460040 to i32*)
ret void
}